Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#152 Poco::Net Reactor performance and scaling

open
nobody
Net (11)
5
2012-09-14
2011-12-31
Yuki Izayoi
No

In Poco::Net , The reactor is implemented using the select io model.but this model 's performance and scaling is not good
On the windows, the select just support max 64 sockets.
On the linux,Poco use the epoll model to simulate select,but the performance is not good because every time in the select,Poco recreate the epoll handle and re-insert the socket list into the epoll handle.

Solution :
1.Add a handle based (like epoll) socket selector interface , On the Linux just use epoll to implement this interface,On the windows, use a object which manage the socket list inside it and use select to implement this interface
2.Provide an asio io model such as Proactor.

Discussion

  • Yuki Izayoi
    Yuki Izayoi
    2011-12-31

    Or provide completely different implemention for Reactor on windows and linux. avoid to use the cross-platform select model.On the linux use epoll effectively.
    The performance is very important for large-scale long-connection servers.like mmo-game servers,Wish poco will improve the reactor preformance.

    By the way : The default tcp server use the default thread pool whch only support max 16 connections.and it can be improved.

     
  • James Mansion
    James Mansion
    2012-01-01

    That is not true - the default value for FD_SETSIZE is 64. You can change it - read the documentation on select.

    I do think it would make sense for the existing reactor implementation to delegate to libev, either by embedding it or detecting it at build time. And it would be valuable to wrap libevent, which has a proactor-like system that uses IOCP on Windows and uses select/poll/etc on other platforms.

    I can't see a good reason to reinvent wheels for this.

     
  • I'm also in favor of providing a wrapper around libevent. This should be in a separate library (libPocoNetAsync?). Anyone want to do this?

     
  • Cristian Greco
    Cristian Greco
    2012-01-02

    Hi,
    I think Poco should provide its own pure C++ implementation of event notifications for networking (improved reactor, proactor, timers, async dns, ecc...) such as in Boost ASIO and ACE, but with a clean design and better readability (two of the most important features of Poco): having a new high-performance C++ implementation would be a killer feature for Poco. On the contrary, adding a dependency on the libevent C library could be annoying for some users.
    My two cents :)