scaling rails for $5.50 per day - october 2014 atlrug presentation
DESCRIPTION
Scaling Rails - October 2014 ATLRUG (Atlanta Ruby Users Group) Presentation - by Andy Slocum @ ThoughtworksTRANSCRIPT
![Page 1: Scaling Rails for $5.50 per day - October 2014 ATLRUG Presentation](https://reader033.vdocument.in/reader033/viewer/2022051818/5495b52ab479594c4d8b4d9a/html5/thumbnails/1.jpg)
SCALING RAILS FOR $7 $5.50 A DAY
Andy Slocum
A t l a n t a R u b y U s e r G r o u p
![Page 2: Scaling Rails for $5.50 per day - October 2014 ATLRUG Presentation](https://reader033.vdocument.in/reader033/viewer/2022051818/5495b52ab479594c4d8b4d9a/html5/thumbnails/2.jpg)
About Organizing Project Background Scaling Concerns Architecture Problems Successes Lessons Learned Recent Steps
![Page 3: Scaling Rails for $5.50 per day - October 2014 ATLRUG Presentation](https://reader033.vdocument.in/reader033/viewer/2022051818/5495b52ab479594c4d8b4d9a/html5/thumbnails/3.jpg)
ONLINE ORGANIZING
Email lists rule everything
1000 emails 100 reads 10 visits 1 participant
![Page 4: Scaling Rails for $5.50 per day - October 2014 ATLRUG Presentation](https://reader033.vdocument.in/reader033/viewer/2022051818/5495b52ab479594c4d8b4d9a/html5/thumbnails/4.jpg)
PROJECT BACKGROUND
One week campaign 2 full-time organizers 4 developers 1 analyst 1 domain expert 3 months development time Few days of UX expert’s time
![Page 5: Scaling Rails for $5.50 per day - October 2014 ATLRUG Presentation](https://reader033.vdocument.in/reader033/viewer/2022051818/5495b52ab479594c4d8b4d9a/html5/thumbnails/5.jpg)
![Page 6: Scaling Rails for $5.50 per day - October 2014 ATLRUG Presentation](https://reader033.vdocument.in/reader033/viewer/2022051818/5495b52ab479594c4d8b4d9a/html5/thumbnails/6.jpg)
![Page 7: Scaling Rails for $5.50 per day - October 2014 ATLRUG Presentation](https://reader033.vdocument.in/reader033/viewer/2022051818/5495b52ab479594c4d8b4d9a/html5/thumbnails/7.jpg)
SCALING CONCERNS
![Page 8: Scaling Rails for $5.50 per day - October 2014 ATLRUG Presentation](https://reader033.vdocument.in/reader033/viewer/2022051818/5495b52ab479594c4d8b4d9a/html5/thumbnails/8.jpg)
ARCHITECTURE
Ruby 2 Rails 4 MongoDB Amazon CloudFront Heroku Geocoder + free zip code data Memcache (25Mb) Mailgun github -> snap-ci -> heroku NewRelic + google analytics Omniauth Gatling
Rails (puma)
Amazon Cloudfront
Mongo
Memcache
Mailgun
Snap-ci +
Github
![Page 9: Scaling Rails for $5.50 per day - October 2014 ATLRUG Presentation](https://reader033.vdocument.in/reader033/viewer/2022051818/5495b52ab479594c4d8b4d9a/html5/thumbnails/9.jpg)
PERFORMANCE TUNING & PREDICTION
prod error rate mean response 95% response 99% response rps
1: 2xdyno 100 users 0% 931 2570 7980 38
500 users 11% 4515 30120 31660 57
5: 2xdyno 150 users 0% 1197 3230 5110 55
500 users 9% 5236 30150 30600 54
5: 2xdyno 500 users cold 1% 7605 32890 60000 44
geo_near caching 500 users hot 0% 2181 9990 25740 72
![Page 10: Scaling Rails for $5.50 per day - October 2014 ATLRUG Presentation](https://reader033.vdocument.in/reader033/viewer/2022051818/5495b52ab479594c4d8b4d9a/html5/thumbnails/10.jpg)
ACTUAL PERFORMANCE
25k visitors / 70k page views 25% of traffic in 3 hours (checking time & location) Average visit: 1 minute
![Page 11: Scaling Rails for $5.50 per day - October 2014 ATLRUG Presentation](https://reader033.vdocument.in/reader033/viewer/2022051818/5495b52ab479594c4d8b4d9a/html5/thumbnails/11.jpg)
PROBLEMS
Mongo support in Rails 4 Cache invalidation Unused functionality Google maps API free tier Organizations wanted data we weren’t set up to provide Organizers needed to take notes on users / events Mobile
![Page 12: Scaling Rails for $5.50 per day - October 2014 ATLRUG Presentation](https://reader033.vdocument.in/reader033/viewer/2022051818/5495b52ab479594c4d8b4d9a/html5/thumbnails/12.jpg)
SUCCESSES
News coverage ~50 rallies organized + ~70 rallies advertised International reach Handled the load Using Geocoder with free zip data Adapt quickly to new problems Clean UX
![Page 13: Scaling Rails for $5.50 per day - October 2014 ATLRUG Presentation](https://reader033.vdocument.in/reader033/viewer/2022051818/5495b52ab479594c4d8b4d9a/html5/thumbnails/13.jpg)
![Page 14: Scaling Rails for $5.50 per day - October 2014 ATLRUG Presentation](https://reader033.vdocument.in/reader033/viewer/2022051818/5495b52ab479594c4d8b4d9a/html5/thumbnails/14.jpg)
COSTS
Monthly: Github - $7.00 Heroku - $124.74 (2 dynos, mongo)
CDN Traffic: AWS - $8.93 (50 GB data + 4M requests) (7+125)/30 + 9/7 ~= $5.50
![Page 15: Scaling Rails for $5.50 per day - October 2014 ATLRUG Presentation](https://reader033.vdocument.in/reader033/viewer/2022051818/5495b52ab479594c4d8b4d9a/html5/thumbnails/15.jpg)
LESSONS LEARNED
Mobile is a first-class concern (30% of traffic) Validate external resources before deployment (mailgun) Prepare to share / export data Ask more questions of your expert users Don’t gold plate your performance tuning Focus on optimizing & polishing the first 2 pages
![Page 16: Scaling Rails for $5.50 per day - October 2014 ATLRUG Presentation](https://reader033.vdocument.in/reader033/viewer/2022051818/5495b52ab479594c4d8b4d9a/html5/thumbnails/16.jpg)
![Page 17: Scaling Rails for $5.50 per day - October 2014 ATLRUG Presentation](https://reader033.vdocument.in/reader033/viewer/2022051818/5495b52ab479594c4d8b4d9a/html5/thumbnails/17.jpg)
GOING FARTHER
OpenStreetMap NewRelic monitoring + Heroku memory limit (512MB) workers Integer(ENV['PUMA_WORKERS'] || 3) threads Integer(ENV['MIN_THREADS'] || 1), Integer(ENV['MAX_THREADS'] || 16)
![Page 18: Scaling Rails for $5.50 per day - October 2014 ATLRUG Presentation](https://reader033.vdocument.in/reader033/viewer/2022051818/5495b52ab479594c4d8b4d9a/html5/thumbnails/18.jpg)
THANKS TO
Mike G. Susan H. Kyle de B. Tim M. Zack E. Louis K.
QUESTIONS?
cwilk Rosemary K. P. Turley Svetlana I. Robin D.
[email protected] / @andyflip