I remember the earlier version of the Redis server was single-threaded.
Is the latest stable version of Redis, 6.2.6 still single-threaded?
When 2 clients call INCR
command for the same key at the same timestamp, does Redis use a single thread to sequentially perform INCR
one after another, or does Redis use 2 threads with a lock for synchronization?
2
Answers
Pitfalls and misconceptions
All Redis 6.X.X release notes
An still opened issue for redis 7 [FEATURE] Make redis 7 multi-threaded
As I understand from all these links I would answer your question saying redis uses just one thread, not two with locks and syncs.
To further add from Redis official doc:
It is not designed to benefit from multiple CPU cores. People are supposed to launch several Redis instances to scale out on several cores if needed. It is not really fair to compare one single Redis instance to a multi-threaded data store.
…
Being single-threaded, Redis favors fast CPUs with large caches and not many cores. At this game, Intel CPUs are currently the winners. It is not uncommon to get only half the performance on an AMD Opteron CPU compared to similar Nehalem EP/Westmere EP/Sandy Bridge Intel CPUs with Redis. When client and server run on the same box, the CPU is the limiting factor with redis-benchmark.
…
https://redis.io/topics/benchmarks#pitfalls-and-misconceptions