Scalingprezo

Embed Size (px)

Citation preview

  • 1. Fail Whale

2. Scaling & RailsYou scale a website, not a framework 3. Scaling SOPsGeneral Things Standard Operating Procedures for website scaling 4. OODA Loop 5. OODA Loop 6. ObserveNew RelicClient (customers) needs User needs 7. Rumsfeld 8. RumsfeldKnown knowns Known unknownsUnknown unknowns 9. Observe:Known knowns:What do we know that we know aboutclients? 10. Observe: Known unknownsDo we know that we know at least afew pages users are likely to hitoften? 11. Observe: Known unknownsWe know users will use some featuresmore than others.We dont know which ones they willbe. 12. Observe: Known unknownsWe know which devices they will beconsuming the site with.We dont know the percentages forsure. 13. Observe: Unknown unknownsWhat assumptions do we bring, and which of them may be wrong? 14. OrientFocus on the known knowns 15. OrientWe know the strategies: 16. OrientPage CachingFragment Caching Action CachingDatabase Caching 17. Decide Por ejemplo:To cache the landing page, orarticles, or productsOr All of the above 18. Actclass ProductsController < ApplicationControllercaches_page :index, :showdef index@products = Product.page(params[:page]).per_page(10)enddef show@product = Product.find(params[:id])end# Other actions omitted.end 19. Actclass ProductSweeper < ActionController::Caching::Sweeperobserve Productdef after_update(product)expire_page products_pathexpire_page product_path(product)expire_page "/"FileUtils.rm_fr "#{page_cache_directory}/products/page"endend 20. Iterate 21. ObserveWhat do we learn from Httperf + Browsermob+ Apache Bench + user feedback? 22. ObserveWhat have we learned about ourSOPs? 23. ObserveWhich known unknowns have becomeKnown knowns? 24. ObserveWhich Unknown unknowns have becomeKnown unknowns? 25. OrientWhich techniques can be used tosolve the known knowns? 26. Iterate 27. Mise en place 28. [Miz on plas] Mise en place (pronounced [miz on plas],literally "putting in place") is a French phrase defined by the Culinary Institute of America as "everything in place", as in set up. It is used in professional kitchens to refer to organizingand arranging the ingredients (e.g., cuts ofmeat, relishes, sauces, par-cooked items,spices, freshly chopped vegetables, and othercomponents) that a cook will require for themenu items that he or she expects to prepare during his/her shift.[1] 29. GT mise en placeWhat might our developer kitchen look like? Our staging kitchen? Our production kitchen? 30. Development kitchen LivereloadRspecCucumberCaching is turned off 31. Development kitchenShould we turn it on? 32. Development kitchenShould we turn it on? 33. Development kitchen HTTPerf & friends:Allow us to do load testing 34. Development kitchen Apache bench$ ab -n 5 -c 5 http://127.0.0.1:3000/articles-n requests is the number of requests-c concurrency is the number of multiple requests 35. Development kitchen HTTPerf$ brew install httperf$ httperf --num-conns=20 --rate=10 --timeout=5--server=localhost --port=3000 --uri=/articles 36. Development kitchenAutobench:Allows us to measure load testingOn local machines 37. Development kitchen Should each developer explicitlytest with caching turned on beforepushing to master? 38. Development kitchenOr is this inefficient andconfusing? 39. Development kitchen(Discuss, decide, act, observe,orient, iterate) 40. Staging KitchenCI server runs test suite twice: 41. Staging kitchenFirst Jenkins runs with caching off 42. Staging kitchenThen Jenkins runs with caching turned on 43. Staging kitchenThen code gets pushed to staging 44. Staging kitchenShould features be accepted if theyonly pass with caching off? 45. Staging kitchenIf so, we need a second environment,similar to staging, where caching is turned on. 46. Staging kitchen(Discuss, decide, act, observe,orient, iterate) 47. Production kitchenWhat process do we have in place toget user feedback? 48. Production kitchenDo we rely on our tools? 49. Production kitchenHow do we get user feedback? 50. Production kitchenDo we get it from our clients, whoare not our users? 51. Production kitchenOr do we get it directly (somehow?) 52. To be answered:1) Do we turn caching on indevelopment?2) Do we run tests against cachingbefore pushing?3) Do we accept features thathavent passed caching? 53. Discuss