[Eventmachine-talk] next_tick efficiency

Francis Cianfrocca
Mon, 12 Nov 2007 16:37:48 -0000

On Nov 12, 2007 6:55 PM, Roger Pack <rogerpack2005 at gmail.com>
wrote:
> It seems that next tick, when used, always consumes 100% of available
> CPU.  An unexpected drawback, I''m sure.
>
> I therefore wish that there were a function similar to next_tick that
> was still quite frequent but didn''t consume so much CPU.  Setting
a
> timer is still only good for up to 200x/sec (so compared to next_tick,
> that is far slower).
>
> So what I wish could be built in future revisions would be something
> alone the lines of
> next_time_this_connections_state_changes_somehow(execute_this)
> i.e. when their backpressure changes at all, you''d execute the
block.
> Then you wouldn''t need to poll so much (as anything does, using
> next_tick), and you could still keep excellent control of your stacks
> as the pressure changes.


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?