Ray Smith has asked for the wisdom of the Perl Monks concerning the following question:

Event::Lib appears to provide an efficient mechanism to handle thousands of open sockets. When I converted my code to make use of it and tried to compare the new version with my previous structure based on IO:Select, I found that Event::Lib appears to be limited to 1024 open sockets. Does anyone know how to exceed this limit? I looked at the eventlib(libevent-1.3d) code on which Event::Lib is based and it was not clear how or if one could modify it.
Thanks for you attention.

Replies are listed 'Best First'.
Re: Event::Lib 1024 socket limit
by Fletch (Bishop) on Sep 12, 2007 at 23:13 UTC

    Sounds like you've hit an OS soft or hard limit. Check with your sysadmin and/or consult your shell's documentation for its ulimit command.

      You are correct that there is a limit of 1024 sockets when not running as root. However, as root, we often extend the maximum to 8K. In our IO::Select based implementation we have gone to 2K open sockets. But at these numbers the CPU load is considerable. I'm hoping there is someone out there who has found a way to get Event::Lib past the 1024 limit. I was thinking this might be by recompiling libevent. I was hoping that there might be a switch or something I might correct to get past this limit.
Re: Event::Lib 1024 socket limit
by jbert (Priest) on Sep 13, 2007 at 14:19 UTC
    You might also want to look at Danga::Socket. I think it uses an epoll interface which should be optimal on Linux (maybe Event::Lib uses the same interface, not sure).

    Djabberd (which I think is built on Danga::Socket) has scaled to more than 1k sockets, anyway: http://brad.livejournal.com/2230083.html.