Src2011 killer clouds

816
-1

Published on

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
816
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
4
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Src2011 killer clouds

  1. 1. Monday, 18 April 2011
  2. 2. What You Dont Know About Clouds Could Kill You!!!Monday, 18 April 2011
  3. 3. What we learned about the cloud by building and scaling a corporate intranet.Monday, 18 April 2011
  4. 4. the • External infrastructure • Easy commissioning " Easy scaling • Less maintenance • Focus on what makes your app differentMonday, 18 April 2011
  5. 5. But sometimes...Monday, 18 April 2011
  6. 6. TIMTOWTDI (pronounced Tim Toady)Monday, 18 April 2011
  7. 7. TIMTOWTDIBSCINABTE (pronounced Tim Toady Bicarbonate)Monday, 18 April 2011
  8. 8. @tangleofwire gar@55degrees.co.ukMonday, 18 April 2011
  9. 9. MINTMonday, 18 April 2011
  10. 10. IntranetMonday, 18 April 2011
  11. 11. Google APIs IntranetMonday, 18 April 2011
  12. 12. Google APIs Intranet HR ServerMonday, 18 April 2011
  13. 13. Google APIs Intranet HR Interface HR ServerMonday, 18 April 2011
  14. 14. Google APIs Google Sites Intranet HR Interface HR ServerMonday, 18 April 2011
  15. 15. Scaling • Eliminate N+1 queries • Add database indexes • Page, Fragment, Action caching • Background jobsMonday, 18 April 2011
  16. 16. Other best practices • Metrics & useful debugging data • Notifications & error numbers • MonitoringMonday, 18 April 2011
  17. 17. Max load (many simultaneous web requests)Monday, 18 April 2011
  18. 18. Google Sites IntranetMonday, 18 April 2011
  19. 19. AJAX polling (are we there yet?)Monday, 18 April 2011
  20. 20. i.Reduce number of HTTP callsMonday, 18 April 2011
  21. 21. Annual leave • Request • View summaryMonday, 18 April 2011
  22. 22. Intranet HR Interface HR ServerMonday, 18 April 2011
  23. 23. API wrappers (separate the things that change)Monday, 18 April 2011
  24. 24. Integration tests (how are you today?)Monday, 18 April 2011
  25. 25. ii.Be prepared for APIs to changeMonday, 18 April 2011
  26. 26. People pages • Directory • HR API • Google APIsMonday, 18 April 2011
  27. 27. Google APIs Intranet HR Interface HR ServerMonday, 18 April 2011
  28. 28. Sync (avoid unnecessary HTTP requests)Monday, 18 April 2011
  29. 29. Timeouts (discard requests or retry later)Monday, 18 April 2011
  30. 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. 31. Exponential backoff (handle intermittent network problems)Monday, 18 April 2011
  32. 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. 33. Isolate components (one error shouldn’t stop everything)Monday, 18 April 2011
  34. 34. Fail (and go to the pub cache)Monday, 18 April 2011
  35. 35. iii.Expect services to failMonday, 18 April 2011
  36. 36. Other considerations • HTTP caching • WebhooksMonday, 18 April 2011
  37. 37. HTTP caching (anything new?)Monday, 18 April 2011
  38. 38. Intranet HR serviceMonday, 18 April 2011
  39. 39. Intranet GET /user/23 HR serviceMonday, 18 April 2011
  40. 40. Intranet { user 23 + ETag } HR serviceMonday, 18 April 2011
  41. 41. Intranet HR serviceMonday, 18 April 2011
  42. 42. Intranet GET /user/23 + ETag HR serviceMonday, 18 April 2011
  43. 43. Intranet 304 Not Modified HR serviceMonday, 18 April 2011
  44. 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.html wants.xml { render :xml => @user } end end endMonday, 18 April 2011
  45. 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. 46. Webhooks (have your people call my people)Monday, 18 April 2011
  47. 47. Intranet HR serviceMonday, 18 April 2011
  48. 48. Intranet GET /generate_report? callback=/foo HR serviceMonday, 18 April 2011
  49. 49. Intranet working... HR serviceMonday, 18 April 2011
  50. 50. Intranet POST /foo { fascinating data } HR serviceMonday, 18 April 2011
  51. 51. iv.Reduce time and cost of HTTP callsMonday, 18 April 2011
  52. 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. 53. Thanks $ git log --format=%aN | sort -u @rogerbooth @mrloop @cframe @grahamsavage @douglasfshearer @aw221 @jaz303 @lenary @subblueMonday, 18 April 2011
  54. 54. Questions?Monday, 18 April 2011
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×