skip to Main Content

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


  1. Pitfalls and misconceptions

    Redis is, mostly, a single-threaded server from the POV of commands execution

    All Redis 6.X.X release notes

    Redis can now optionally use threads to handle I/O, allowing to serve
    2 times as much operations per second in a single instance when
    pipelining cannot be used.

    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.

    Login or Signup to reply.
  2. 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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search