On 10/8/07, alexd at nominet.org.uk <alexd at nominet.org.uk>
wrote:>
> Hi -
>
> I''ve been developing DNS support for EventMachine. Everything
seems to
> work just fine, but I''m having a slight problem with Timers.
>
> I originally developed the code to use EventMachine::Timer.new{} in order
> to time out each Connection. However, this didn''t work when trying
to soak
> test the code. If I ran more than a thousand queries (but only 100
> concurrently) then I got back a RuntimeError, saying "no timer".
[I should
> point out that I am cancelling each timer when the connection is closed]
>
> So I changed my code to use comm_inactivity_timeout=(). However, this
> didn''t seem to work right. With Timer.new, if I set the timeout to
2
> seconds, I would get a timeout after 2 seconds. With
> comm_inactivity_timeout=(2), I got a timeout after 3.75 seconds for TCP,
> and 1.3 seconds for UDP (consistently).
>
> Can somebody please offer me some advice on how to time out connections
> (accurately) for many concurrent connections? I''m also interested
as to
> why the comm_inactivity_timeout seems to be so inaccur
>
> Thanks in advance for your help.
You''ll get the "no timer" error if you have too many of them
outstanding.
Current production EMs max out at 1000 simultaneously-active timers, and
there''s currently no way to increase them dynamically. I''ve
tested private
builds with as many as 100,000 timers, though, with no ill effects. If you
want to try that, then modify line 117 of ext/em.h, then run make clean and
make to recompile the extension.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://rubyforge.org/pipermail/eventmachine-talk/attachments/20071008/26ab13d8/attachment-0001.html