Find a way to cut costs and improve performance. Provide a very easy way to scale the new solution. Maintain all the RoR application functionality, focusing on APIs for the mobile clients. Tight, TIGHT budget.
Asynchronous (non-blocking) web server framework. Based on EventMachine Lightweight Rack API & middleware support Very simple yet powerful configuration Fully async processing Websockets out of the box No callbacks!! Low memory footprint (only 65 KB!) 0.3 ms from top -> bottom! http://postrank-labs.github.com/goliath/
Very simple, very fast work queue. Saves memory (lots of it). Multiple queues. Generic interface. Several Ruby clients to choose from. Send your Ruby object as a JSON. Parallel and asynchronous. Scales VERY easily. http://kr.github.com/beanstalkd/
Ruby implementation of the Reactor Pattern Highly scalable Performance optimized Mature & stable Eliminates the complexities of threaded network programming. Active community Examples: Thin & Goliath.
October 1995 by Douglas Schmidt AKA Dispatcher or Notifier Handle requests delivered to an application by one or more clients. Single threaded by definition Separates application logic from the reactor implementation Task switching = no multithreading!
Latest version has no built-in routing system. Ilya Grigorik (Goliath’s creator) suggests to start multiple Goliath servers, each one with one endpoint and use HAProxy or any reverse proxy to route the requests. That’s kind of cumbersome, don’t you think?
Routing was done thru convention over configuration with a little of Ruby’s reflection abilities mixed with some inheritance: http://server/api/game/CreateGame was redirected to the api/game/create_game.rb controller: class CreateGame < APIController . . . . end
Goliath: add processes or servers and configure them in HAProxy. Couchbase: add servers to the cluster. Done!(we used Scalar to automate this, too)
From ~450 req/s to ~1300 req/s. From 4 to 1 EC2 application servers. Triple performance while reducing costs. Video upload and processing fast and reliable: ~250 jobs/s