Src2011 killer clouds

Embed Size (px)

Citation preview

  • 1.Monday, 18 April 2011

2. What You Dont KnowAbout Clouds CouldKill You!!!Monday, 18 April 2011 3. What we learned about the cloud bybuilding and scalinga corporateintranet.Monday, 18 April 2011 4. the External infrastructure Easycommissioning" Easy scaling Less maintenance Focus on what makes your appdifferentMonday, 18 April 2011 5. But sometimes...Monday, 18 April 2011 6. TIMTOWTDI(pronounced Tim Toady)Monday, 18 April 2011 7. TIMTOWTDIBSCINABTE(pronounced Tim Toady Bicarbonate)Monday, 18 April 2011 8. @[email protected], 18 April 2011 9. MINTMonday, 18 April 2011 10. IntranetMonday, 18 April 2011 11. Google APIsIntranetMonday, 18 April 2011 12. Google APIsIntranetHR ServerMonday, 18 April 2011 13. Google APIs IntranetHR Interface HR ServerMonday, 18 April 2011 14. Google APIsGoogle Sites IntranetHR Interface HR ServerMonday, 18 April 2011 15. Scaling Eliminate N+1 queries Add database indexes Page, Fragment, Action caching Background jobsMonday, 18 April 2011 16. Other best practices Metrics & useful debugging data Notifications & error numbers MonitoringMonday, 18 April 2011 17. Max load(many simultaneous web requests)Monday, 18 April 2011 18. Google SitesIntranetMonday, 18 April 2011 19. AJAX polling(are we there yet?)Monday, 18 April 2011 20. i.Reduce number of HTTP callsMonday, 18 April 2011 21. Annual leave Request View summaryMonday, 18 April 2011 22. IntranetHR Interface HR ServerMonday, 18 April 2011 23. API wrappers(separate the things that change)Monday, 18 April 2011 24. Integration tests (how are you today?)Monday, 18 April 2011 25. ii.Be prepared for APIs to changeMonday, 18 April 2011 26. People pages Directory HR API Google APIsMonday, 18 April 2011 27. Google APIs IntranetHR Interface HR ServerMonday, 18 April 2011 28. Sync(avoid unnecessary HTTP requests)Monday, 18 April 2011 29. Timeouts(discard requests or retry later)Monday, 18 April 2011 30. require net/http url = URI("http://example.com/feed") req = Net::HTTP.new(url.host, url.port) req.read_timeout = HTTP_READ_TIMEOUT req.open_timeout = HTTP_OPEN_TIMEOUTMonday, 18 April 2011 31. Exponentialbackoff(handle intermittent network problems)Monday, 18 April 2011 32. times_tried = 0 max_retries = 5 begin times_tried += 1 feed = HRApi.get_employee_feed rescue => e if times_tried < max_retries sleep 4 ** times_tried retry end raise e, "max retries reached" endMonday, 18 April 2011 33. Isolatecomponents(one error shouldnt stop everything)Monday, 18 April 2011 34. Fail(and go to the pub cache)Monday, 18 April 2011 35. iii.Expect services to failMonday, 18 April 2011 36. Other considerations HTTP caching WebhooksMonday, 18 April 2011 37. HTTP caching (anything new?)Monday, 18 April 2011 38. IntranetHR serviceMonday, 18 April 2011 39. Intranet GET /user/23HR serviceMonday, 18 April 2011 40. Intranet { user 23 + ETag }HR serviceMonday, 18 April 2011 41. IntranetHR serviceMonday, 18 April 2011 42. Intranet GET /user/23 + ETagHR serviceMonday, 18 April 2011 43. Intranet 304 Not ModifiedHR serviceMonday, 18 April 2011 44. #users_controller def show @user = User.find(params[:id]) expires_in 24.hours if stale? (:etag => @user, :last_modified => @user.updated_at) respond_to do |wants|wants.htmlwants.xml { render :xml => @user } end end endMonday, 18 April 2011 45. #client code def get_user u = User.find(23) return u if u.max_age < Time.now.utc headers = { If-None-Match => u.etag, If-Modifed-Since => u.last_modifed } ... data = request.get(path, headers) ... return u if response.code == 304 return u.update_attributes(data) endMonday, 18 April 2011 46. Webhooks(have your people call my people)Monday, 18 April 2011 47. Intranet HR serviceMonday, 18 April 2011 48. IntranetGET /generate_report?callback=/foo HR serviceMonday, 18 April 2011 49. Intranet working... HR serviceMonday, 18 April 2011 50. Intranet POST /foo{ fascinating data } HR serviceMonday, 18 April 2011 51. iv.Reduce time and cost of HTTPcallsMonday, 18 April 2011 52. Rules of thumb i.Reduce number of HTTP calls ii.Be prepared for APIs to change iii.Expect services to fail iv.Reduce time and cost of HTTP callsMonday, 18 April 2011 53. Thanks $git log --format=%aN | sort -u @rogerbooth @mrloop @cframe @grahamsavage @douglasfshearer @aw221 @jaz303 @lenary @subblueMonday, 18 April 2011 54. Questions?Monday, 18 April 2011