Scaling @ REA

Post on 13-Jul-2015

150 views 0 download

Transcript of Scaling @ REA

Scaling @ REAGeoffrey Giesemann

scaling ain't easyno silver bullet, no secret sauce

our first ever Rails app

but Rails *can* scale!

do we need to scale?

$ siege -t 60s list_of_urls.txt** SIEGE 2.72** Preparing 15 concurrent users for battle.The server is now under siege...

pay attention to:● transaction rate● throughput● concurrency

Vertical Scalin'aka more RAMs plz

HTTP Caching

Expiration:Cache-Control: public, max-age=60

Validation:ETag: 1234567890abcdefLast-Modified: Thu, 30 Aug 2012 14:03:49 EST

HTTP Caching 101

Empty cache:

Non-empty cache:

realestate.com.au/buy

ActionController::ConditionalGet

class DooHickeyController < ApplicationController def show_something expires_in 1.day @doo_hickey = DooHickey.find(params[:id]) if stale?(:etag => @doo_hickey, :last_modified => @doo_hickey.updated_at ) @doo_hickories = @doo_hickey.children # expensive repond_to do |format| # etc... end end endend

(and S3 asset hosting)

Content Distribution Networks

S3 is an infinite disk that is plugged in to the internet

can pretend you're not on S3 if you set up DNS appropriately

currently migrating all property images on to S3

getting out of the static asset hosting business

you can do with with Rails too!

use jammit-s3 to compile/load your assets into S3

paperclip will let you upload into S3

dragonfly support resizing with S3 caching

scaling lessons learned

simpler is easier to scale than complexparticularly if you can separate the reading/writing parts of

your app

when in doubt - testyou do TDD right? scaling shouldn't be different

scaling lessons learned

the fastest request is the one you never make

CDNs are awesomeprovided their edge nodes match the distribution of your

users

the cloud is coming to AU

rackspace is building a DC in Sydneyopening ~late 2012

CDN and Route53 available in Sydneymore on the way?

Questions?