Imagine a waiter who freezes solid the moment a customer orders — unable to take any other order until the kitchen delivers the plate. Scale that to a web server and you have the C10k problem: in the late 1990s, serving ten thousand simultaneous connections required ten thousand threads, each burning megabytes of stack while mostly waiting for the network.
Dan Kegel named the problem in 1999. The answer was already taking shape in operating-system kernels: instead of one thread per connection, use one thread that watches all connections at once and reacts only when a socket is actually ready to send or receive.
Linux answered with epoll (introduced in kernel 2.5.44, 2002). The idea is deceptively simple: register your sockets with the kernel, then call epoll_wait — a single system call that blocks until at least one socket is ready. No spinning, no polling every socket manually. The kernel does the watching; your thread does the work.
This pattern — register interest, wait for readiness, act, repeat — has a name: the Reactor. It is the skeleton inside nginx, Node.js, Redis, and virtually every high-throughput server built in the last two decades.
Comments
Loading comments...