Round-robin event handlers in aeCreateEventLoop(). #767

kstephens opened this Issue Nov 15, 2012 · 1 comment


None yet

2 participants



  • aeCreateEventLoop() processes the eventLoop->events[] in index order.
  • The order of aeFileEvent eventLoop->event[] is by aeFiredEvent->fd.
  • This means clients with lower FDs (likely to be connected longer) are serviced before clients with higher FDs.
  • We use a modified Ruby Resque::Worker that self-throttles its polling: if there is work, it does not sleep between Jobs, if there is no work it progressively lengthens the sleep between polls.
  • This means the Resque::Worker with the lowest FD gets greedy, younger Workers get less work.
  • This is also true for any redis clients that vie for the same key-value resource.


  • Use a rotating offset into eventLoop->fired[] to give each client a chance to be "first".

Topic Branches

badboy commented Nov 15, 2012

Submitting this as a pull-request against the unstable branch would make it easier to see the actual changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment