Fast Servers
2026-03-10
Edited: 2026-03-10
Old Design
The old design for a server
- main loop waits for some event
- the loop dispatches tasks based on the file descriptor (fd)
- state is stored in the file descriptor and dictates what to do
A worker thread can be created via fork() to handle the task, but using threadpools was more popular. Accepting a connection then just involves adding a fd to the group and then dispatching further events related to that fd.