Scaling @ REA
-
Upload
ggiesemann -
Category
Technology
-
view
151 -
download
0
Transcript of Scaling @ REA
![Page 1: Scaling @ REA](https://reader035.fdocuments.net/reader035/viewer/2022071813/55a3b36f1a28ab480f8b45d4/html5/thumbnails/1.jpg)
Scaling @ REAGeoffrey Giesemann
![Page 2: Scaling @ REA](https://reader035.fdocuments.net/reader035/viewer/2022071813/55a3b36f1a28ab480f8b45d4/html5/thumbnails/2.jpg)
![Page 3: Scaling @ REA](https://reader035.fdocuments.net/reader035/viewer/2022071813/55a3b36f1a28ab480f8b45d4/html5/thumbnails/3.jpg)
scaling ain't easyno silver bullet, no secret sauce
![Page 4: Scaling @ REA](https://reader035.fdocuments.net/reader035/viewer/2022071813/55a3b36f1a28ab480f8b45d4/html5/thumbnails/4.jpg)
our first ever Rails app
but Rails *can* scale!
![Page 5: Scaling @ REA](https://reader035.fdocuments.net/reader035/viewer/2022071813/55a3b36f1a28ab480f8b45d4/html5/thumbnails/5.jpg)
![Page 6: Scaling @ REA](https://reader035.fdocuments.net/reader035/viewer/2022071813/55a3b36f1a28ab480f8b45d4/html5/thumbnails/6.jpg)
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](https://reader035.fdocuments.net/reader035/viewer/2022071813/55a3b36f1a28ab480f8b45d4/html5/thumbnails/7.jpg)
Vertical Scalin'aka more RAMs plz
![Page 8: Scaling @ REA](https://reader035.fdocuments.net/reader035/viewer/2022071813/55a3b36f1a28ab480f8b45d4/html5/thumbnails/8.jpg)
![Page 9: Scaling @ REA](https://reader035.fdocuments.net/reader035/viewer/2022071813/55a3b36f1a28ab480f8b45d4/html5/thumbnails/9.jpg)
![Page 10: Scaling @ REA](https://reader035.fdocuments.net/reader035/viewer/2022071813/55a3b36f1a28ab480f8b45d4/html5/thumbnails/10.jpg)
HTTP Caching
![Page 11: Scaling @ REA](https://reader035.fdocuments.net/reader035/viewer/2022071813/55a3b36f1a28ab480f8b45d4/html5/thumbnails/11.jpg)
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](https://reader035.fdocuments.net/reader035/viewer/2022071813/55a3b36f1a28ab480f8b45d4/html5/thumbnails/12.jpg)
Empty cache:
Non-empty cache:
realestate.com.au/buy
![Page 13: Scaling @ REA](https://reader035.fdocuments.net/reader035/viewer/2022071813/55a3b36f1a28ab480f8b45d4/html5/thumbnails/13.jpg)
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](https://reader035.fdocuments.net/reader035/viewer/2022071813/55a3b36f1a28ab480f8b45d4/html5/thumbnails/14.jpg)
(and S3 asset hosting)
Content Distribution Networks
![Page 15: Scaling @ REA](https://reader035.fdocuments.net/reader035/viewer/2022071813/55a3b36f1a28ab480f8b45d4/html5/thumbnails/15.jpg)
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](https://reader035.fdocuments.net/reader035/viewer/2022071813/55a3b36f1a28ab480f8b45d4/html5/thumbnails/16.jpg)
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](https://reader035.fdocuments.net/reader035/viewer/2022071813/55a3b36f1a28ab480f8b45d4/html5/thumbnails/17.jpg)
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](https://reader035.fdocuments.net/reader035/viewer/2022071813/55a3b36f1a28ab480f8b45d4/html5/thumbnails/18.jpg)
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](https://reader035.fdocuments.net/reader035/viewer/2022071813/55a3b36f1a28ab480f8b45d4/html5/thumbnails/19.jpg)
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](https://reader035.fdocuments.net/reader035/viewer/2022071813/55a3b36f1a28ab480f8b45d4/html5/thumbnails/20.jpg)
Questions?