No Callbacks, No Threads: Async & Cooperative Web Servers with Ruby 1.9
Location: Room 309- 310
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 is a web performance engineer at Google, co-chair of the W3C Web Performance Working group, and author of High Performance Browser Networking (O’Reilly) book. In short, an internet plumber.
Comments on this page are now closed.