Redis — single-threaded event loop design
- Constraint
- As an in-memory KVS, low latency is mandatory. Multi-threading increases lock contention and debugging complexity.
- Decision
- Command processing is serialized on a single-threaded event loop. I/O is async via epoll/kqueue; CPU-bound work is delegated to forked child processes (RDB/AOF).
- Consequence
- CPU utilization per instance is limited, but latency stays predictable and the implementation stays simple. Scale horizontally via sharding.
review 2027-01-15 · @codenju