What are the differences between Redis's threading model in older versions versus improvements introduced in more recent versions for handling input and output operations?
Short answer
While command execution itself has traditionally remained single threaded, more recent Redis versions introduced optional multi threaded I/O, allowing the reading and parsing of client requests and the writing of responses to be handled by multiple threads, which can improve…
Advertisement
AModel answer
While command execution itself has traditionally remained single threaded, more recent Redis versions introduced optional multi threaded I/O, allowing the reading and parsing of client requests and the writing of responses to be handled by multiple threads, which can improve throughput specifically for network intensive workloads while the core command execution logic remains single threaded to preserve Redis's simplicity and consistency guarantees.
Example
CONFIG SET io-threads 4 CONFIG SET io-threads-do-reads yes
Real-world example
A high throughput application enables multi threaded I/O on a recent Redis version, measuring a meaningful throughput improvement for their network intensive workload while the core data operations remain safely single threaded.
Likely follow-ups
- Does enabling multi threaded I/O change any of Redis's consistency guarantees?
- How many I/O threads are recommended for a typical production workload?
Related topics