Databases 8 min read

Why Redis Is So Fast: Architecture, Single‑Thread Model, and Multithreading in Redis 6.0

This article explains why Redis achieves high throughput—up to 100,000 QPS—by leveraging in‑memory storage, simple data structures, a single‑threaded event loop with I/O multiplexing, and the optional multithreaded I/O model introduced in Redis 6.0, including configuration details and safety considerations.

Top Architect
Top Architect
Top Architect
Why Redis Is So Fast: Architecture, Single‑Thread Model, and Multithreading in Redis 6.0

The author, a senior architect, introduces Redis performance and invites readers to explore why this in‑memory key‑value store is exceptionally fast.

According to the official benchmark, a single Redis instance can sustain roughly 100 k queries per second (QPS), demonstrating its high throughput capabilities.

Key reasons for Redis's speed include:

1) Entirely in‑memory operation, eliminating disk I/O latency.

2) Simple, purpose‑built data structures that enable fast read/write operations.

3) A single‑threaded event loop that avoids context switches, lock contention, and deadlocks.

4) Use of I/O multiplexing (select/poll/epoll) to monitor many sockets concurrently, allowing a single thread to handle many client connections efficiently.

5) A custom reactor‑style file‑event handler that processes network events in a single thread while still supporting multiple concurrent sockets.

Redis’s single‑threaded model refers specifically to the network request module; other modules may still use multiple threads.

Redis 6.0 introduces optional multithreading to offload network I/O processing, improving CPU utilization when the bottleneck is I/O rather than memory.

To enable multithreading, modify the configuration file as follows:

io-threads-do-reads yes
io-threads <number_of_threads>

The official recommendation is 2–3 threads on a 4‑core machine and up to 6 threads on an 8‑core machine, always keeping the thread count lower than the number of CPU cores.

Even with multithreading enabled, command execution remains single‑threaded, so there are no concurrency safety issues for data operations; the multithreaded part only handles network read/write and protocol parsing.

In summary, Redis achieves its performance through in‑memory storage, simple data structures, a single‑threaded event loop with I/O multiplexing, and an optional multithreaded I/O layer introduced in Redis 6.0, which can be safely enabled via configuration.

PerformanceRedisMultithreadingdatabasesIO MultiplexingSingle Thread
Top Architect
Written by

Top Architect

Top Architect focuses on sharing practical architecture knowledge, covering enterprise, system, website, large‑scale distributed, and high‑availability architectures, plus architecture adjustments using internet technologies. We welcome idea‑driven, sharing‑oriented architects to exchange and learn together.

0 followers
Reader feedback

How this landed with the community

login 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.