No Callbacks, No Threads: Async & Cooperative Web Servers with Ruby 1.9
Multi-threaded servers compete for the global interpreter lock (GIL) and incur the cost of continuous context switching, potential deadlocks, or plain wasted cycles. Asynchronous servers, on the other hand, create a mess of callbacks and errbacks, complicating the code. But, what if, you could get all the benefits of asynchronous programming, while preserving the synchronous look and feel of the code – no threads, no callbacks?
In this talk we’ll look at how Ruby 1.9 Fibers, combined with EventMachine, can enable us to build a fully asynchronous web-server, while preserving the feeling of synchronous code – the best of both worlds. A cooperative, pure IO-scheduled web server to power your next Rails, or Rack application!
We will dive deep into the architecture, libraries, and internals of Ruby:
- Limitations of threaded web servers, libraries and the global interpreter lock
- (Dis)advantages of asynchronous network programming with the EventMachine library
- Changes to Ruby 1.9 threading, GIL, and introduction of Fibers
- Cooperative IO scheduling in Ruby 1.9: Pro’s & Cons
- Fibers + Callbacks: next generation Ruby web-server
Ilya Grigorik
igvita.com
Ilya Grigorik is the founder and CTO of PostRank, a real-time social engagement monitoring and analytics platform. He is an avid Ruby and web architecture blogger (www.igvita.com, Twitter: @igrigorik), speaker, and a community evangelist.
Dan Sinclair
PostRank Inc.
Dan Sinclair spends his days at PostRank Inc. wandering around Rails and over EventMachine. Dan can be found online at www.everburning.com and on Twitter @dj2sincl.
Comments on this page are now closed.

















Comments
Excellent talk as always Ilya.
Best presentation of the conference.
Fantastic talk. Really enjoyed and learned a lot from this one.
great talk, the best I’ve seen so far
Best presentation I have seen thus far.
Ilya did a great job as usual. Excellent stuff.
Exactly what I was expecting, needing, wanting to hear. My expectations were exceeded.
Star of the show so far. The only thing would have made it better would have been an appearance of Dan Sinclair
Best presentation so far. Technical, exciting, and valuable.
Really fantastic talk. Worth the price of admission to RailsConf just for this talk. Thanks Ilya!
Big problems. Real solutions. Best talk so far.
Awesome! This was the type of talk we come here for. Intensely interesting and extremely valuable.