[Twisted-Python] Max number of simultaneous TCP connection

James Y Knight foom at fuhm.net
Tue Jul 6 12:49:51 EDT 2004


On Jul 5, 2004, at 2:49 AM, klcheung0829 at sinaman.com wrote:
> Is there a maximum number of simultaneous connection for the 
> TCPServer?  I already set the ulimit -n 10000.  But it fails to accept 
> connection once it reaches about 1024.  Any way to increase it ?

This is a limit on the select() system call, which twisted uses in its 
default reactor. The maximum is changable via a #define (for C code), 
but you'd have to recompile python to do that. Fortunately, twisted 
includes a poll-based reactor, which doesn't have this limit. Use 
"twistd --reactor=poll".

BTW, the python poll API is such that epoll support could be added with 
no python-level API change. The python poll() object already uses add 
and remove methods with no way to read back the current list, so 
changing it to maintain the state in the kernel instead of in userspace 
should be pretty easy.

James





More information about the Twisted-Python mailing list