Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Faster on Rails

Faster on Rails

How to make Rails application faster

David Paluy

May 29, 2012
Tweet

More Decks by David Paluy

Other Decks in Technology

Transcript

  1. Me • Co-Founder, Startup. • Previously, Co-Founder AlgoTrading Startup •

    Working with Ruby, since 2007 dpaluy dpaluy davidpaluy IsraelRb @LinkedIn
  2. Agenda • Usability • Web Servers • Rack Web Servers

    • Back-end • Front-end Note: Links
  3. Usability Delay User Reaction 0-100 ms Instant 0-300 ms Feels

    sluggish 100-1000ms Machine is working... 1s + Mental context switch 10s + I'll come back later... Source
  4. Usability Delay User Reaction 0-100 ms Instant 0-300 ms Feels

    sluggish 100-1000ms Machine is working... 1s + Mental context switch We're here!!! (on average...) 10s + I'll come back later... Source
  5. Web Servers: Apache vs Nginx Source The main advantage of

    the asynchronous approach is scalability!
  6. Unicorn sucks at: • 3rd-party APIs • OpenID consumers •

    Reverse proxy implementations with editing/censoring • HTTP server push • Long polling • Reverse AJAX • Real-time upload processing
  7. Rainbows! - Unicorn for sleepy apps and slow clients Rainbows

    ThreadPool Application Read more about Rainbows here and Github Source
  8. SPDY – by Google • Allows client and server to

    compress request and response headers • Allows multiple, simultaneously multiplexed requests over a single connection • Allows the server to actively push resources to the client that it knows the client will need (e.g. JavaScript and CSS files) SPDY on Rails by Roman Shterenzon
  9. Tidbits: Linux Server • ulimit -n • memcached -t x

    // x – CPU cores • Monitor everything (StatsD with Graphite, Munin, NewRelic, UnionStation)
  10. Client Side • YSlow • PageSpeed by Google • HAML

    vs ERB (Source) • How to make your JavaScript Fast
  11. Wish you Faster Browsing! Scaling = replacing all components of

    a car while driving it at 100 mph (Mike Krieger, Instagram)
  12. References • WebPage Test by Google • PageSpeed by Google

    • SPDY by Google • How to scale a Ruby Web Service • Scaling Instagram • Measuring Site Speed with Navigation Timing