Get the App
SLTechnology News&Howtos  ›  Database  › 

What is the maximum concurrency of redis?

Shulou Source: shulou.com Published: 2022-06-01 12:16:33 09月20日 Update

What this article shares to you is about the maximum concurrency of redis. The editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

Concurrency problems in redis

Redis has been used as a cache for a long time. Redis runs as a single process, and commands are executed one after another. I always thought that there would be no concurrency problem. I didn't realize it until I saw the relevant information today.

Examples of specific problems

There is a key, suppose the name is myNum, which stores Arabic numerals, suppose the current value is 1, there are multiple connections to operate on myNum, this time there will be concurrency problems. Suppose there are two connections linkA and linkB, both of which do the following, take out the value of myNum, + 1, and then save it back to see the following interaction:

LinkA get myNum = > 1linkB get myNum = > 1linkA set muNum = > 2linkB set myNum = > 2

After the operation, the result may be 2, which is not consistent with our expectation of 3.

Let's look at a specific example:

Tags: Problem transaction command face time time two example atom process consistency simultaneously instance persistence more result maximum success consistency multiple Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL Redmi NVidia Shulou Technology OPPO Reno