Ruby Weekly is a weekly newsletter covering the latest Ruby and Rails news.

EventMachine: Get Excited By Scalable Non-Blocking I/O

By Peter Cooper / March 19, 2010

EventMachine is a simple(ish), fast, event-driven I/O library for Ruby. Its goal is to provide highly scalable I/O performance with an easy-to-use API wrapped around the nastiest parts of the process (since typical Ruby coding practices aren't particularly event-driven friendly). Aman Gupta has put together an awesome 114-page deck of slides (also available as a PDF) that walks through EventMachine with lots of practical code examples.

The presentation walks through:

  • Who uses EventMachine (a lot of big guys - Heroku, GitHub, 37signals, Engine Yard, PostRank)
  • What EventMachine is good for
  • Ruby's other I/O solutions (and why they suck)
  • What a "reactor" is
  • How to write asychronous code with EventMachine's API
  • How EventMachine provides event-compatible iterators and timers
  • EventMachine's message channels

Even though Aman's slides are meant to go alongside a live presentation, they stand well on their own and provide more than enough incentive to check out EventMachine is event-driven I/O is something that would benefit you, so stop reading this post and get flicking through Aman's awesome slides!

Comments

  1. Mike Perham says:

    I gave a talk two months ago about using EventMachine with Ruby 1.9 and Fibers to provide asynchronous processing with a more standard Ruby coding style.

    The problem with EventMachine and Ruby 1.8 is that it forces the callback style of programming on your entire application (e.g. see Cramp vs Rails).

    http://www.mikeperham.com/2010/01/27/scalable-ruby-processing-with-eventmachine/

  2. Sohan says:

    A link to your post is added at the Drink Rails blog.

  3. Justin Mazzi says:

    PDF link:

    Oops! (509)
    This account's public links are generating too much traffic and have been temporarily disabled!

  4. AkitaOnRails says:

    Damn, the PDF link at scribd is failing on me :-( Anyone has another link?

  5. Lori M Olson says:

    You've killed that dropbox link for the PDF with your post ;-)

  6. AkitaOnRails says:

    Ah, forgive me, it was the timetobleed.com link that's failing, the download link within scribd's flash player works fine.

  7. Peter Cooper says:

    Oh man, the only reason I did a direct link was because it was to Dropbox and I assumed they'd "just work" being a big service and all :-) Thanks for the heads up.

Other Posts to Enjoy

Twitter Mentions