Loading src/event/epoll.cpp +15 −0 Changes for src/event/epoll.cpp: 15 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -843,6 +843,21 @@ namespace netplus { // own design and measurement, not a blanket EPOLLEXCLUSIVE. if (ss->_Type == sockettype::QUIC) { setevent.events |= EPOLLONESHOT; } else { // TCP/SSL listener: accept() is a single short syscall per // event, not a multi-packet drain like the QUIC case above — // it benefits from, rather than being hurt by, letting the // kernel wake exactly one waiting thread per incoming // connection. Without this, level-triggered EPOLLIN on a // shared epoll fd wakes all `threads` workers on every // connect; only one wins accept(), the rest just paid for a // context switch (a thundering herd, worse the more workers // there are). EPOLLEXCLUSIVE (Linux >=4.5) fixes this for // the listener fd itself — unlike EPOLLONESHOT, no rearm is // needed since it doesn't disable the registration. #ifdef EPOLLEXCLUSIVE setevent.events |= EPOLLEXCLUSIVE; #endif } setevent.data.fd = ss->fd(); Loading Loading
src/event/epoll.cpp +15 −0 Changes for src/event/epoll.cpp: 15 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -843,6 +843,21 @@ namespace netplus { // own design and measurement, not a blanket EPOLLEXCLUSIVE. if (ss->_Type == sockettype::QUIC) { setevent.events |= EPOLLONESHOT; } else { // TCP/SSL listener: accept() is a single short syscall per // event, not a multi-packet drain like the QUIC case above — // it benefits from, rather than being hurt by, letting the // kernel wake exactly one waiting thread per incoming // connection. Without this, level-triggered EPOLLIN on a // shared epoll fd wakes all `threads` workers on every // connect; only one wins accept(), the rest just paid for a // context switch (a thundering herd, worse the more workers // there are). EPOLLEXCLUSIVE (Linux >=4.5) fixes this for // the listener fd itself — unlike EPOLLONESHOT, no rearm is // needed since it doesn't disable the registration. #ifdef EPOLLEXCLUSIVE setevent.events |= EPOLLEXCLUSIVE; #endif } setevent.data.fd = ss->fd(); Loading