可能有多少个套接字连接? [英] How many socket connections possible?
问题描述
有人知道现代标准根服务器上可以有多少个tcp-socket连接吗? (通常,每个连接上的流量都较少,但是所有连接都必须一直处于打开状态.)
Has anyone an idea how many tcp-socket connections are possible on a modern standard root server? (There is in general less traffic on each connection, but all the connections have to be up all the time.)
编辑:我们将使用Linux服务器.
We will use a Linux Server.
推荐答案
我实现了1600k并发空闲套接字连接,同时在Linux桌面(16G RAM,I7 2600 CPU)上达到了57k req/s.这是一个用epoll用C编写的单线程http服务器.源代码位于
I achieved 1600k concurrent idle socket connections, and at the same time 57k req/s on a Linux desktop (16G RAM, I7 2600 CPU). It's a single thread http server written in C with epoll. Source code is on github, a blog here.
我使用JAVA/Clojure在两台计算机上进行了600k并发HTTP连接(客户端和服务器).详细信息帖子,HN讨论:
I did 600k concurrent HTTP connections (client & server) on both the same computer, with JAVA/Clojure . detail info post, HN discussion: http://news.ycombinator.com/item?id=5127251
连接费用(使用epoll):
The cost of a connection(with epoll):
- 应用程序每个连接需要一些RAM
- TCP缓冲区2 * 4k〜10k,或更多
- epoll需要一些内存来存储epoll(7)中的文件描述符
每个注册文件描述符的成本大约为90 32位内核上的字节数为64个字节,而64位内核上的字节数为160个字节.
Each registered file descriptor costs roughly 90 bytes on a 32-bit kernel, and roughly 160 bytes on a 64-bit kernel.
这篇关于可能有多少个套接字连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!