Custom Nginx Modules: Accelerate Rails, HTTP Tricks
Location: Portland Ballroom 253
Nginx has become the webserver of choice for many Rails users, replacing Apache or Lighttpd. Nginx is known for its simple yet powerful configuration DSL, built-in proxy balancer (no more mod_proxy headaches), and wicked fast request processing.
If you’ve got a high-volume Rails app in production that needs even more speed, this is the session for you. Adam Wiggins of Heroku will show you how to convert critical code paths to Nginx modules for blinding speed. Not to mention the ability to do some HTTP tricks that would be difficult to achieve with Rails and Mongrel alone.
We’ll begin with a brief introduction to the Nginx internal architecture, the hooks for the module API, and the toolchain used to build modules. Then we’ll roll up our sleves and get down and dirty with the code from Heroku’s own authentication module ngx_heroku_gate. This module serves as a wrapper for the thousands of Rails apps hosted at Heroku, providing a standard login-authentication against the main user database without requiring any modification to the hosted apps. This technique relies on nginx’s excellent proxy capabilities, and the custom module is the special sauce that makes it all work.
The session assumes some familiarity with the innards of the HTTP protocol, web proxying, gcc, and make, and is therefore recommended for advanced developers. So dust off your C compiler and prepare to push the limits of nginx, Rails, and HTTP.
People planning to attend this session also want to see:
Adam Wiggins is an entrepreneur, open source enthusiast, and programming bad-ass from San Francisco. He is a cofounder of Heroku. His past projects include Gyre (open source, web-based Rails debugger) and the Bitscribe agile screencasts, including the one that coined the term atomic coding.
He’s released some Rails plugins such as yaml_db and axeman, and is a contributor (two recipes) to the book Advanced Rails Recipes by Mike Clark & Chad Fowler, due out in March.