DEV Community

Discussion on: Why Redis is Single-Threaded

Collapse
 
rhymes profile image
rhymes

Hi Nick! Nice intro.

Redis 6 is going to add optional multi threaded I/O to its codebase.

Unfortunately I can't find a direct link to public release notes / roadmap but if you download the latest 6.0 release, 6.0-rc3, you'll find a file called 00-RELEASE_NOTES which contains the following:

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.

You can find further evidence of this in the THREADED I/O section of the redis.conf:

# Now it is also possible to handle Redis clients socket reads and writes
# in different I/O threads. Since especially writing is so slow, normally
# Redis users use pipelining in order to speedup the Redis performances per
# core, and spawn multiple instances in order to scale more. Using I/O
# threads it is possible to easily speedup two times Redis without resorting
# to pipelining nor sharding of the instance.
#
# By default threading is disabled, we suggest enabling it only in machines
# that have at least 4 or more cores, leaving at least one spare core.
# Using more than 8 threads is unlikely to help much. We also recommend using
# threaded I/O only if you actually have performance problems, with Redis
# instances being able to use a quite big percentage of CPU time, otherwise
# there is no point in using this feature.

Haven't tried it yet though :)

Redis 6 is due to be released at the end of April 2020