Where is my scalable api?
Upcoming SlideShare
Loading in...5
×
 

Where is my scalable api?

on

  • 936 views

Initially delivered at LA RubyConf 2013, this presentation describes how cutting-edge technology helped to triple performance and drastically cut costs in a mobile social game. Juan Pablo Genovese, a ...

Initially delivered at LA RubyConf 2013, this presentation describes how cutting-edge technology helped to triple performance and drastically cut costs in a mobile social game. Juan Pablo Genovese, a Ruby Architect from Altoros Systems Argentina, explains how, despite the extremely tight budget, the customer managed to:

- go from ~450 req/s to ~1300 req/s
- reduce the number of EC2 application servers from four to one
- provide fast and reliable video uploading and processing
- achieve very easy scaling with automation

while maintaining all the functions of the original RoR app.

Statistics

Views

Total Views
936
Views on SlideShare
868
Embed Views
68

Actions

Likes
1
Downloads
5
Comments
0

6 Embeds 68

http://blog.altoros.com 56
http://altorosblog.phpmaintest.altoros.corp 5
http://feeds.feedburner.com 3
https://twitter.com 2
http://dddd 1
http://localhost 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Where is my scalable api? Where is my scalable api? Presentation Transcript

  • Helping your customers to cut costs in their web APIs.
  •  16 years in Software Development From S/390 to Android In love with Ruby since 2006 Working in @eljuanchosf Love to dance Tango and play Blues guitar
  •  Set of programming components and standards. Open up your app to the world. Integration!
  •  Mobile social game (iOS & Android) Video upload & encoding JSON API AWS -> EC2/S3
  • Autoscale with Scalr.com
  •  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.
  •  Inspiration: Draw Something – http://goo.gl/hi7a6 Goliath Beanstalk Couchbase HAProxy as load balancer. Varnish
  •  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!
  • EM.run { EM::HttpRequest.new(‘http://www.example.com’).get.callback { |http| puts http.response }}
  • EM::HttpRequest.new(first_url).get.callback {|http| second_url = extract_next_url(http.response) EM::HttpRequest.new(second_url).get.callback {|http2| puts http2.response }}
  • require em-synchrony/em-httphttp = EM::HttpRequest.new(first_url).getsecond_url = extract_next_url(http.response)http2 = EM::HttpRequest.new(second_url).get No callbacks and still asynchronous!!!
  •  https://github.com/igrigorik/em-synchrony https://github.com/eventmachine/eventmachine/wiki/protoc ol-implementations
  •  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
  •  Contact Juan Pablo @eljuanchosf Contact Altoros Systems http://altoros.com/contact_us.html