by 许通

高并发理论

极限瓶颈

网卡极限

内核/用户态切换极限

  • 系统上下文的切换

  • 异步回调与协程

  • 关键要理解内核不是解决办法,内核是问题所在。

  • 不要让内核执行所有繁重的任务。将数据包处理,内存管理,处理器调度等任务从内核转移到应用程序高效地完成。让Linux只处理控制层,数据层完全交给应用程序来处理。

  • 内核使用的O(N^2)算法使服务器无法处理1万个并发连接。

CPU切换极限

GC极限

TCP缓存区极限

虚拟机在涉及包处理的时候是相当恐怖的

https://zhuanlan.zhihu.com/p/47877674

网络设备极限

Q. How many concurrent NAT sessions are supported in Cisco IOS NAT? A. The NAT session limit is bounded by the amount of available DRAM in the router. Each NAT translation consumes about 312 bytes in DRAM. As a result, 10,000 translations (more than would generally be handled on a single router) consume about 3 MB. Therefore, typical routing hardware has more than enough memory to support thousands of NAT translations.

作者:Ryane Luo

链接:https://www.zhihu.com/question/20493166/answer/15284400

来源:知乎

著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

主存访问瓶颈(8G/s)

计算思路

SO_REUSEPORT

  • Linux将允许许多进程绑定到同一个端口上

通信均匀地分散

单一IP上使用虚拟化对所有的请求分流到不通计算机

TCPvsUDP