Networked servers - nimrody/knowledgebase GitHub Wiki

Describes a scheme where one thread accepts new connections, and passes the new connection descriptor to a cpu-pinned worker thread (one such worker per CPU). The cpu thread uses epoll or kqueue to listen on data available / write ready events on the sockets it manages and call a protocol fine-state-machine when data is available or the socket is available for write.

The FSM should be simple enough that no more threads are necessary.

An HTTP server implementing the above pattern. Uses co-routines instead of per-thread state machines.