Hi all,

I and my colleague have patched TNonblockingServer of Python thrift library
to use epoll instead of select. Before creating a Jira issue with our
patch, I want to get your advice on how to proceed.
I see several ways of incorporating our changes into existing Python thrift
library:

   1. Create completely new TNonblockingServer class; copy all the relevant
   code from current TNonblockingServer (~50% of the class)
   2. Add another parameter to TNonblockingServer constructor to choose
   which method to use, and then increase complexity of the class (e.g.,
   __init__(..., iofunction='select') )
   3. Separate common parts of select and epoll based TNonblockingServer
   into base class, and inherit from it to implement two distinct servers for
   *select* and *epoll*.

What do you think is better? Any other approach?
We have currently done #1 for lack of time, but I'm willing to refactor the
code.

*Reason for epoll:*
The main for this patch was a limit on the file descriptor value of 1024 in
a select call, which effectively limits the number of opened files
(sockets, etc.) a server process can have at one time.
The current TNonblockingServer implementation raises the exception and
essentially can't resume its work. Since server doesn't control how many
clients actually connect to its port, this makes it rather likely that a
bug in a client can make the server unworkable.

Kind regards,
Andrii Shyshkalov

Reply via email to