TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

The implementation of epoll (2014)

29 点作者 bhaavan超过 4 年前

1 comment

joosters超过 4 年前
While epoll() is a clever interface for handling hundreds of thousands of ongoing connections, it seems badly designed for efficiently coping with hundreds of thousands of <i>short-lived</i> connections.<p>Every time a new connection is established, you need to make a syscall to add that new FD to the epoll set. Each syscall can only register one FD at a time. If your server is accepting thousands of connections a second, it&#x27;s very likely that you are going to accept() many new connections on each event loop around epoll_wait(). This leads to lots and lots of syscalls, which although quite fast on Linux, is still not going to be greatly efficient.<p>Compare to FreeBSD&#x27;s kqueue&#x2F;kevent architecture: It&#x27;s broadly similar to epoll, but you only need to make one syscall per loop: you call kevent() with a changelist of FDs, and it will return a list of all new events across the new + existing FDs in the set.
评论 #24757965 未加载