Multi-threaded TCP server class for general use

mark.r.bannister at googlemail.com mark.r.bannister at googlemail.com
Thu May 7 18:20:27 EDT 2015


Hi,

I needed to develop a highly scalable multi-threaded TCP server in Python and when I started writing it in 2013 I could not find a suitable library that would scale the way I needed but also easy to use.

So I invented one - it's called Pyloom.  If you want to take a look, it's part of my DBIS project at the moment: https://sourceforge.net/p/dbis/code/ci/default/tree/src/pyloom

Question: does anyone see the value of this library?  Would you like me to fork it as a separate project?  Is SF.net good enough or do people prefer Python libraries to be hosted somewhere else?

In a nutshell, Pyloom is a multi-threaded TCP server class which you overload in your own program.  The library provides:

* Connection management.

* 1 or more marshal threads that listen and pick up new connections, passing to a pool of dedicated worker threads, each of which can manage multiple sessions.

* Methods that you override for handling various states: new connection, data received, send data, close connection.

* Can track custom sockets and wake up a session when there is I/O on the socket.

* Has a notification service so that one session can wait for data to be processed/collected by a different session, and can be woken up when the data is ready.

Let me know if anyone is interested in re-using this library.  Tested ok on Linux and Solaris, not tried on Windows yet.

Best regards,
Mark.



More information about the Python-list mailing list