Getting a Grip on CDN Performance - Why and How

3,900 views

Published on

View CDN performance data, learn how you can collect data on CDN performance and get tips on improving CDN performance.

Published in: Technology, Business
2 Comments
3 Likes
Statistics
Notes
No Downloads
Views
Total views
3,900
On SlideShare
0
From Embeds
0
Number of Embeds
21
Actions
Shares
0
Downloads
38
Comments
2
Likes
3
Embeds 0
No embeds

No notes for slide

Getting a Grip on CDN Performance - Why and How

  1. 1. Getting a Grip on CDN Performance Why & Howhttp://www.flickr.com/photos/59632563@N04/6261230701/
  2. 2. How many sites use a CDN?
  3. 3. CDN Performance in the Real Worldhttp://www.flickr.com/photos/59632563@N04/6261230701/
  4. 4. How we measure CDN performanceReal User Monitoring (RUM)Download a 16 KB static file from a CDN to abrowser > send timing data to our serverMore details later on how we do RUM
  5. 5. Total load time (median) in US
  6. 6. Total load time (mean) in US
  7. 7. DNS time (median) in US ~25% of total
  8. 8. DNS time (mean) in US
  9. 9. Connect time (median) in US
  10. 10. First byte time (median) in US
  11. 11. First byte time (mean) in US
  12. 12. Transfer time (median) in US
  13. 13. initcwnd of CDNshttp://www.cdnplanet.com/blog/initcwnd-settings-major-cdn-providers/
  14. 14. Weekdays vs Weekends (mean) ogra phic: ren t dem rough Diffe conne ct th ep eople kdaysMor wee prox ies on
  15. 15. What happened on June 19?DNS time First byte timeImprovement Improvement forfor all CDNs only 2 CDNsBetter caching Object is moreat ISPs popular > gets served from memory now, or ...
  16. 16. Australia: different playing field
  17. 17. CloudFront opened a POP in Sydney lways wins Local POP a
  18. 18. Global performanceIs your CDN fast in your key countries? http://c.turbobytes.com/static/uploads/velocity12/world-static.html http://c.turbobytes.com/static/uploads/velocity12/world-anim.html
  19. 19. Performance varies between statesHow fast is your CDN in your key states? http://c.turbobytes.com/static/uploads/velocity12/us-state-static.html http://c.turbobytes.com/static/uploads/velocity12/us-state-anim.html
  20. 20. Green: not so good in California
  21. 21. Much better in New York
  22. 22. 15 kb versus 100 kb fileMeasure performance of content you have
  23. 23. Monitoring CDN Performancehttp://www.flickr.com/photos/59632563@N04/6261230701/
  24. 24. Access log files of originNo data on how fast the CDN is (duh)Two reasons to analyze em:1. Cache MISS rate2. Spot patterns in requests from the CDN
  25. 25. Access log files of CDNAgain, no data on how fast the CDN isThree reasons to analyze em:1. Cache MISS rate2. Spot patterns in requests from the CDN3. Spot HITs from far-away POPs
  26. 26. Hits from far-away POPs
  27. 27. Backbone synthetic monitoringDatacenter-to-datacenter != the real worldTells you nothing about real user experience nt use i t Do
  28. 28. Real browser synthetic monitoringCatchpoint, Gomez, WebPagetest etc.Real browser, but– Still in a datacenter– Not your real users no cigar C lose , but
  29. 29. With-CDN versus Without-CDNHow much faster do your pages load?WebPagetest:SetDNSName cdn.domain.com www.domain.comoverrideHost cdn.domain.com www.domain.comnavigate www.domain.com
  30. 30. Google Analytics User Timingsvar startTime;function loadJs(url, callback) { var js = document.createElement(script); js.async = js.src = url; var s = document.getElementsByTagName(script)[0]; less js.onload = callback; Use startTime = new Date().getTime(); s.parentNode.insertBefore(js, s);}function myCallback() { var endTime = new Date().getTime(); _gaq.push([_trackTiming, jQuery, Load Library, new Date().getTime() -startTime, Google CDN, 50]);};loadJs(//hostname/path/to/jquery.min.js, myCallback); https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingTiming
  31. 31. Resource Timing APINavigation Timing for page resourcesCross-origin resources must be sent withTiming-Allow-Origin:example.com header forAPI to expose load time details (DNS, etc.)Easy: send header from origin, so CDN sends it too Future!http://dvcs.w3.org/hg/webperf/raw-file/tip/specs/ResourceTiming/Overview.html
  32. 32. How we do RUMhttp://www.flickr.com/photos/like_the_grand_canyon/4580931101/
  33. 33. Starting pointsMeasure small object delivery over HTTPWe want the details, not just total load timeFew beacons from many users, not manybeacons from few usersNo impact on UX
  34. 34. Why use a 16 KB file?
  35. 35. What we actually doNavigation Timing APIloadTime = responseEnd – domainLookupStart2 lines JS on main page; exec after window.onloadLoad rum.js async (not in IE6-8)Check localStorage which CDNs may be usedLoad 16 kb HTML file from CDN, in invisible iframepostMessage timing data from iframe to parentDont wait longer than 5 secondsUpdate localStorage & beacon to server
  36. 36. Not all data is good dataNT API implementation is poor in some browsersIgnore FF<9 & Chrome FrameWe see odd data in Chrome and IE9 tooServer side checks include: Is DNS time >0? Is Connect time > 0? Is TTFB >0?
  37. 37. Tips for improving CDN performancehttp://www.flickr.com/photos/ol1/5539623423/
  38. 38. 1 Set a high initcwnd íf the CDN has a large receive windowhttp://www.flickr.com/photos/59632563@N04/6261230701/
  39. 39. initrwnd of CDNs
  40. 40. 2 Keep connection to CDN open loooong only íf the CDN wants to keep it open longhttp://www.flickr.com/photos/59632563@N04/6261230701/
  41. 41. 3 send Vary:Accept-Encoding … so your CDN sends GZIPed when it shouldhttp://www.flickr.com/photos/59632563@N04/6261230701/
  42. 42. 4 dont send Vary:User-Agent … to prevent a high cache MISS ratehttp://www.flickr.com/photos/begnaud/243996426/
  43. 43. 5 add jitter to low TTL cache-control for better UX and origin protectionhttp://www.flickr.com/photos/59632563@N04/6261230701/
  44. 44. 6 set high TTL for DNS especially important if traffic is low/medhttp://www.flickr.com/photos/59632563@N04/6261230701/
  45. 45. http://www.flickr.com/photos/27282406@N03/4134166721/
  46. 46. www.turbobytes.com

×