Scaling @ REA

20
Scaling @ REA Geoffrey Giesemann

Transcript of Scaling @ REA

Page 1: Scaling @ REA

Scaling @ REAGeoffrey Giesemann

Page 2: Scaling @ REA
Page 3: Scaling @ REA

scaling ain't easyno silver bullet, no secret sauce

Page 4: Scaling @ REA

our first ever Rails app

but Rails *can* scale!

Page 5: Scaling @ REA
Page 6: Scaling @ REA

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

Page 7: Scaling @ REA

Vertical Scalin'aka more RAMs plz

Page 8: Scaling @ REA
Page 9: Scaling @ REA
Page 10: Scaling @ REA

HTTP Caching

Page 11: Scaling @ REA

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

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

HTTP Caching 101

Page 12: Scaling @ REA

Empty cache:

Non-empty cache:

realestate.com.au/buy

Page 13: Scaling @ REA

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

Page 14: Scaling @ REA

(and S3 asset hosting)

Content Distribution Networks

Page 15: Scaling @ REA

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

Page 16: Scaling @ REA

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

Page 17: Scaling @ REA

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

Page 18: Scaling @ REA

scaling lessons learned

the fastest request is the one you never make

CDNs are awesomeprovided their edge nodes match the distribution of your

users

Page 19: Scaling @ REA

the cloud is coming to AU

rackspace is building a DC in Sydneyopening ~late 2012

CDN and Route53 available in Sydneymore on the way?

Page 20: Scaling @ REA

Questions?