#epoll
Posts
-
Digging into nginx's Source 7: The Event Loop — epoll, Timers, Posted Events and accept
We follow one turn of ngx_process_events_and_timers(), the loop that lets a single-threaded worker juggle thousands of connections. How epoll is plugged in through a function-pointer table (ngx_event_actions), the connection array pre-built to worker_connections slots and its free list, EPOLLET and the instance bit that filters stale events, how the red-black timer tree becomes epoll_wait's timeout, the posted queues, and which of accept_mutex (off by default), EPOLLEXCLUSIVE and reuseport decides who accepts a new connection — checked with strace, gdb and the debug log.