• Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
732
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
3
Comments
0
Likes
1

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Monday, 18 April 2011
  • 2. What You Dont Know About Clouds Could Kill You!!!Monday, 18 April 2011
  • 3. What we learned about the cloud by building and scaling a corporate intranet.Monday, 18 April 2011
  • 4. the • External infrastructure • Easy commissioning " Easy scaling • Less maintenance • Focus on what makes your app differentMonday, 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. @tangleofwire gar@55degrees.co.ukMonday, 18 April 2011
  • 9. MINTMonday, 18 April 2011
  • 10. IntranetMonday, 18 April 2011
  • 11. Google APIs IntranetMonday, 18 April 2011
  • 12. Google APIs Intranet HR ServerMonday, 18 April 2011
  • 13. Google APIs Intranet HR Interface HR ServerMonday, 18 April 2011
  • 14. Google APIs Google Sites Intranet HR 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 Sites IntranetMonday, 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. Intranet HR 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 Intranet HR 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. Exponential backoff (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. Isolate components (one error shouldn’t 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. Intranet HR serviceMonday, 18 April 2011
  • 39. Intranet GET /user/23 HR serviceMonday, 18 April 2011
  • 40. Intranet { user 23 + ETag } HR serviceMonday, 18 April 2011
  • 41. Intranet HR serviceMonday, 18 April 2011
  • 42. Intranet GET /user/23 + ETag HR serviceMonday, 18 April 2011
  • 43. Intranet 304 Not Modified HR 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.html wants.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. Intranet GET /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 HTTP callsMonday, 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