Databases 7 min read

Redis 6 Multithreaded I/O: Design, Implementation, and Performance Evaluation

The article explains how Redis 6 introduced multithreaded network I/O to overcome single‑thread bottlenecks, describes the lock‑free read/write flow, provides benchmark configuration and results showing nearly double GET/SET throughput, and outlines upcoming Redis 6.0 features.

Big Data Technology & Architecture
Big Data Technology & Architecture
Big Data Technology & Architecture
Redis 6 Multithreaded I/O: Design, Implementation, and Performance Evaluation

RedisConf 2019, held in San Francisco from April 1‑3, marked the 10th anniversary of Redis with over 1,600 registrants and 80 talks, including a presentation by Redis creator antirez that demonstrated the multithreaded I/O feature in Redis 6 delivering more than a two‑fold performance boost.

For the traditionally single‑threaded Redis, the main performance bottleneck lies in network I/O. Two optimization directions are common: replacing the kernel network stack with technologies like DPDK, and leveraging multithreading to fully utilize multiple cores, as seen in projects such as Memcached.

After many community requests, antirez finally added multithreaded I/O to Redis 6. The multithreaded part handles only network read/write and protocol parsing; command execution remains single‑threaded to avoid the complexity of synchronizing keys, Lua scripts, transactions, and other data structures.

The multithreaded I/O read flow works as follows:

The main thread accepts new connections and places incoming read events into a global pending‑read queue.

After handling the read event, the main thread distributes the connection to one of the I/O threads using round‑robin scheduling and then busy‑waits for the I/O threads to finish.

I/O threads read the request data and parse it (no command execution at this stage).

The main thread then executes all commands sequentially and clears the pending‑read queue.

This process is completely lock‑free because the main thread waits until all I/O threads have completed their work, eliminating data‑race scenarios.

Performance comparison was conducted on Alibaba Cloud Ubuntu 18.04 instances (8 CPU 2.5 GHz, 8 GB RAM, ecs.ic5.2xlarge). The Redis server ran on the unstable branch with multithreaded I/O, while the single‑thread baseline used Redis 5.0.5. The following configuration enables four I/O threads and allows request parsing on I/O threads:

io-threads 4 # enable 4 I/O threads
io-threads-do-reads yes # also parse requests on I/O threads

The benchmark command used was:

redis-benchmark -h 192.168.0.49 -a foobared -t set,get -n 1000000 -r 100000000 --threads 4 -d ${datasize} -c 256

Results show that GET/SET throughput with four I/O threads is almost double that of the single‑thread version. These figures are intended only to verify that multithreaded I/O brings real performance gains; they are not exhaustive latency or concurrency tests and should not be taken as production metrics.

Redis 6.0 is expected to be released at the end of 2019, bringing significant improvements in performance, protocol handling, and access control. Antirez is focusing on optimizing Redis and its clustering capabilities, and a Redis Cluster proxy is slated for release later in the year to improve multi‑language SDK compatibility.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

redismultithreadingBenchmarkdatabasesI/O performance
Big Data Technology & Architecture
Written by

Big Data Technology & Architecture

Wang Zhiwu, a big data expert, dedicated to sharing big data technology.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.