Add an epoll poller for keep-alive parking on Linux

EpollPoller keeps the Poller contract with EPOLLONESHOT: a delivered
descriptor stays registered but disabled, so arm() modifies it, and adds
it when it was closed in between. wake() writes to an eventfd that stays
armed. make_poller() picks it on Linux and falls back to poll().

poll() goes over every parked connection on each wait, and epoll only
over the ready ones. With 10000 idle keep-alive connections parked, 10
active clients got 95k requests per second instead of 2.4k, at 0.1 ms
instead of 4 ms each. With few connections nothing changed.

The contract tests now run on both backends.
This commit is contained in:
yhirose committed 2026-11-21 00:25:50 -05:00
1 parent 7b6af186af
commit f92079e633
2 files changed
+107 -2

No files matched your search

+6 -1
View File
@@ -33934,7 +33934,12 @@ void PrintTo(const PollerBackend &backend, std::ostream *os) {
// Every backend runs the same contract tests. A new one is added here only.
std::vector<PollerBackend> poller_backends() {
return {{"poll", &detail::PollPoller::create}};
return {
{"poll", &detail::PollPoller::create},
#ifdef __linux__
{"epoll", &detail::EpollPoller::create},
#endif
};
}
// A descriptor whose readability the test controls.