lesismal / nbio

Pure Go 1000k+ connections solution, support tls/http1.x/websocket and basically compatible with net/http, with high-performance and low memory cost, non-blocking, event-driven, easy-to-use.
MIT License
2.11k stars 151 forks source link

What is the principle of realizing 10 million connections to a single server? #420

Closed ahfuzhang closed 1 month ago

ahfuzhang commented 2 months ago

请问实现单台服务器 1000 万连接的原理是什么呢?

我看了其他关于 C10M 问题的实现:几乎都是 DPDK+用户态协议栈+多队列网卡等一系列技术的组合才能做到这一点。

谢谢

What is the principle of realizing 10 million connections to a single server?

I've looked at other implementations of the C10M problem: it's almost always a combination of DPDK + userland stack + multi-queue NICs and a host of other technologies that make this possible.

Thank you!

lesismal commented 2 months ago

欢迎来交流!

目前只试过1M连接,没太大压力。 至于 C10M,epoll的内核协议栈流程太长了应该是确实不适合,DPDK这些,或者路由设备之类的直接在内核实现的方案更适合。

对单节点承载量,我觉得要根据服务节点的协议层次定位来做对应的在线和吞吐追求:

  1. 比如路由器交换机这些主要处理网络协议栈的,可以去追求单节点更大连接数和更大吞吐极限
  2. 应用业务,单节点承载C10M的意义可能不大,应用层的业务种类太多,不同种类对应不同的、不可预知的开销和优化方案,对应不同的响应性能、对应不同的对其他基础设施的依赖比如数据服务的交互,而很多应用业务节点的扩容也可以通过简单的堆机器就能解决、更容易些,只要追求适度的承载量和性能就可以了
github-actions[bot] commented 1 month ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 1 month ago

This issue was closed because it has been inactive for 14 days since being marked as stale.