Getting a Grip on CDN Performance - Why and How


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
No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
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 & How
  2. 2. How many sites use a CDN?
  3. 3. CDN Performance in the Real World
  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 CDNs
  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?
  19. 19. Performance varies between statesHow fast is your CDN in your key states?
  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 Performance
  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 www.domain.comoverrideHost www.domain.comnavigate
  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);
  31. 31. Resource Timing APINavigation Timing for page resourcesCross-origin resources must be sent header forAPI to expose load time details (DNS, etc.)Easy: send header from origin, so CDN sends it too Future!
  32. 32. How we do RUM
  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 performance
  38. 38. 1 Set a high initcwnd íf the CDN has a large receive window
  39. 39. initrwnd of CDNs
  40. 40. 2 Keep connection to CDN open loooong only íf the CDN wants to keep it open long
  41. 41. 3 send Vary:Accept-Encoding … so your CDN sends GZIPed when it should
  42. 42. 4 dont send Vary:User-Agent … to prevent a high cache MISS rate
  43. 43. 5 add jitter to low TTL cache-control for better UX and origin protection
  44. 44. 6 set high TTL for DNS especially important if traffic is low/med
  45. 45.
  46. 46.
  1. A particular slide catching your eye?

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