I just pushed an implementation of NonblockingServer in ruby to my fork on github.

http://github.com/kballard/thrift (primary fork)
or the pri/kballard/ruby_lib_rewrite branch on thruhere (mirror)

The primary goal here was to make the server queue on messages rather than on connections - by this I mean if you allow 20 concurrent threads, it should be able to support 40 concurrent connections (or more) but only process 20 concurrent messages at once.

It should be a drop-in replacement for ThreadPoolServer with the one requirement that the transportFactory must return FramedTransports. Note that it should actually be more resistant to bad data than the other servers - if the NonblockingServer receives a malformed message (e.g. client lies about size of the frame, sends an unterminated struct) the NonblockingServer should throw an exception (and queue it in the @exception_q, see ThreadPoolServer's #rescuable_serve about that) while other servers should tie up a thread forever. But this is only a theory, I haven't tested bad data (it's not like thrift is secure against attacks anyhow).

Please test it out and let me know if it works properly.

-Kevin Ballard

--
Kevin Ballard
[EMAIL PROTECTED]



Reply via email to