Home  >  Article  >  Database  >  Why distribution must have redis

Why distribution must have redis

(*-*)浩
(*-*)浩Original
2019-11-22 11:27:141874browse

Why distribution must have redis

When using redis in a project, we mainly consider it from two perspectives: performance and concurrency. Of course, redis also has other functions such as distributed locks, but if it is just for other functions such as distributed locks, there are other middleware (such as zookpeer, etc.) instead, and it is not necessary to use redis.

Therefore, this question is mainly answered from two perspectives: performance and concurrency. (Recommended learning: Redis video tutorial)

(1) Performance

As shown in the figure below, we encounter the need to execute in SQL that takes a particularly long time and whose results do not change frequently is particularly suitable for putting the running results into the cache. In this way, subsequent requests will be read from the cache, so that the request can be responded to quickly.

Why distribution must have redis

(2) Concurrency

As shown in the figure below, in the case of large concurrency, all requests directly access the database. There will be a connection exception in the database. At this time, you need to use redis to perform a buffering operation so that the request can access redis first instead of directly accessing the database.

Why distribution must have redis

For more Redis-related technical articles, please visit the Redis database usage tutorial column to learn!

The above is the detailed content of Why distribution must have redis. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn