select vs poll vs epoll

发布于 2024-09-29 02:25:55 字数 130 浏览 2 评论 0原文

我正在设计一个新服务器,需要支持数千个 UDP 连接(大约 100,000 个会话)。有人可以解释一下selectpollepoll吗?它将帮助我知道该使用哪一个。

I am designing a new server which needs to support thousands of UDP connections (somewhere around 100,000 sessions). Can someone explain select vs poll vs epoll? It will help me know which one to use.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

白色秋天 2024-10-06 02:25:55

如果您使用 Linux,答案是 epoll;如果您使用 FreeBSD 或 Mac OS X,答案是 kqueue;如果您使用 Windows,答案是 i/o 完成端口。

您(几乎肯定)想要研究的一些其他内容包括:

  • 负载平衡技术
  • 多线程网络
  • 数据库架构
  • 完美的哈希表

此外,重要要注意 UDP 没有像反对TCP。由于调试基于网络的解决方案可能具有挑战性,从小规模开始并扩大规模也符合您的最佳利益。

The answer is epoll if you're using Linux, kqueue if you're using FreeBSD or Mac OS X, and i/o completion ports if you're on Windows.

Some additional things you'll (almost certainly) want to research are:

  • Load balancing techniques
  • Multi-threaded networking
  • Database architecture
  • Perfect hash tables

Additionally, it is important to note that UDP does not have "connections" as opposed to TCP. It would also be in your best interest to start small and scale larger since debugging network-based solutions can be challenging.

梦里的微风 2024-10-06 02:25:55

Linux:epoll
FreeBSD:kqueue
窗户:??

有一些包装器库,例如 libevent 和 libev,可以为您抽象这一点。

Linux: epoll
FreeBSD: kqueue
Windows: ??

There are wrapper libraries, such as libevent and libev, which can abstract this for you.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文