What are the reasons for the distributed choice of redis?
What is the reason why redis is chosen to be distributed? Perhaps many people do not understand, in order to let you understand better, the editor summed up the following content, I hope you can gain something according to this article.
Using redis in a project is mainly considered from two perspectives: performance and concurrency. Of course, redis can also do distributed locks and other functions, but if only for distributed locks and other functions, there are other middleware (such as zookpeer, etc.) to replace, it is not necessary to use redis.
Therefore, this question is mainly answered from the perspectives of performance and concurrency.
(1) performance
As shown in the following figure, when we encounter a SQL that takes a long time to execute and the results do not change frequently, it is particularly suitable to cache the run results. In this way, the subsequent request is read in the cache so that the request can respond quickly.
(2) concurrency
As shown in the following figure, in the case of large concurrency, all requests directly access the database, and the database will have a connection exception. At this point, you need to use redis to do a buffering operation so that the request accesses the redis first instead of directly accessing the database.
After reading the above, do you have any further understanding of the reasons why distributed users choose to use redis? If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading.