News for hackers. Stuff that matters.
Re:EventMachine: scalable non-blocking i/o in ruby by donw on Monday March 15, 2010 @10:11PM (#1194725)
I recently had a chance to play around with EventMachine, as I wanted to set up an event-based scheduler within my application.

I was not impressed.

If you try and mix 'EventMachine' and 'other threadsafe code', it seems to fall down pretty hard. In my case, it would run anything executed via next_tick, but would refuse to run any timers... unless I defined a periodic timer in the main event loop, after which timers started working... but only every time the periodic timer executed.

I dug through the code to see if I could fix the problem, and gave up after trying to figure out why they seem to implement timers in two different ways, and it doesn't seem very threadsafe (next_tick is, but none of the timer code looks to be).

EM also expects that your entire application will run inside the EventMachine loop; there's no way to ask EM for a Reactor that you can then hand events.

If you're not running threaded code, then EM will probably work just fine; the Thin webserver looks to be a really nice Rack deployment option if you're on MRI.

If you need to mix EM up with anything else running on the same VM, look elsewhere.

There are no comments on this comment yet.