[Eventmachine-talk] next_tick efficiency

Francis Cianfrocca
Mon, 12 Nov 2007 17:05:12 -0000

On Nov 12, 2007 7:57 PM, Roger Pack <rogerpack2005 at gmail.com>
wrote:
> >Not quite sure what you''re actually trying to do here.
next_tick >will
> >certainly busy-loop if nothing else is happening in the application.
> >Are you waiting for an outbound connection to drain?
>
> Yeah similar to FileStreamer I want to keep tight tabs on the outbound
> queues.  I think the answer for now is to just use periodic_timer and
> call it good.
>
This is a pretty interesting question, actually. I haven''t hit
busy-loop problems with #next_tick in this kind of application because
I usually schedule the next data to send on #next_tick only if the
outbound buffer of a connection is above a certain amount (like a
megabyte, for example). Since the kernel will be eating up the
outbound data in the background, some work is generally being done all
the time.

Are you doing this a different way?


> Question: should period timer warn when a user enters a time less than
> the set quantum?  Do you want me to add that?

I don''t like having it throw an exception but I can''t think of
a
better way to do it.