When a client connects to a backend server, the application is only one part of the story. The kernel does much of the work behind the scenes, managing connection state until the application is ready to handle it.
Now imagine the server receives a sudden traffic burst. CPU usage remains moderate and existing connections still work, but new clients experience delays or connection failures.
The application code may contain only few relevant calls:
Behind these calls, the kernel maintains connection queues and other socket state. A connection can be established before the application calls accept(), so it waits in a bounded accept queue. If connections arrive faster than the application can accept them, that queue can fill.
Socket behavior therefore depends on both the application-level API and the kernel resources behind it, including queues, buffers, descriptors, wakeups, and limits.
This chapter focuses on that kernel side.