Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

(PFC303) Milliseconds Matter: Design, Deploy, and Operate Your Application for Best Possible Performance | AWS re:Invent 2014

2,116 views

Published on

You can't (yet) bend the law of Physics, but you can use the power of the cloud to design applications that run as fast as the speed of light! This session will focus on the best practices for optimizing performance to the very last millisecond. We'll dive into topics such as caching at every layer of your application, TCP optimizations, SSL optimizations, latency based routing, and much more. These best practices can help you to streamline your infrastructure utilization, improve performance and allow you to scale economically.

Published in: Technology

(PFC303) Milliseconds Matter: Design, Deploy, and Operate Your Application for Best Possible Performance | AWS re:Invent 2014

  1. 1. 1.Tight security 2.High availability 3.High performance
  2. 2. Data center/back bone measurements Last-mile measurements Synthetic real user measurements Real user measurements
  3. 3. Tokyo Singapore Hong Kong Tracing route to ns-01.cloudfront.net [207.171.170.1] over a maximum of 32 hops: 1 <1 ms<1 ms<1 ms203.208.249.242 2 <1 ms<1 ms<1 ms203.208.232.54 3 <1 ms<1 ms<1 ms203.208.232.34 4 4 ms4 ms4 ms203.208.232.49 5 <1 ms<1 ms<1 ms202.160.250.225 6 <1 ms<1 ms<1 msge-1-0-0-0.sngc3-dr1.ix.singtel.com [203.208.173.134] 7 <1 ms10 ms<1 msge-4-1-0-0.sngc3-ar3.ix.singtel.com [203.208.172.170] 8 87 ms97 ms97 ms59.128.15.141 9 87 ms97 ms97 msotecbb103.kddnet.ad.jp [124.211.33.1] 10 98 ms77 ms90 msotejbb203.kddnet.ad.jp [59.128.4.61] 11 87 ms88 ms89 mscm-ote252.kddnet.ad.jp [59.128.7.209] 12 77 ms88 ms77 ms118.155.202.30 13 98 ms87 ms98 msns-01.cloudfront.net [207.171.170.1]
  4. 4. Singapore Tokyo DNS Resolver Singapore DNS response d123.sin.cloudfront.net 1.2.3.4 DNS response d123.cloudfront.net CNAME d123.sin.cloudfront.net DNS query d123.sin.cloudfront.net TCP Connect 1.2.3.4 HTTP/1.1 GET /example.jpg DNS query d123.cloudfront.net
  5. 5. Tracing route to ns-sin2-01.cloudfront.net [204.246.164.22] over a maximum of 32 hops: 1 <1 ms <1 ms <1 ms 203.208.249.242 ... 6 13 ms <1 ms <1 ms ge-1-1-0-0.sngtp- ar6.ix.singtel.com [203.208.183.81] 7 32 ms 33 ms 33 ms so-3-1-2-0.hkgcw- cr3.ix.singtel.com [203.208.172.46] 8 31 ms 46 ms 32 ms ge-5-0-6-0.hkgcw- cr3.ix.singtel.com [203.208.152.121] 9 40 ms 35 ms 35 ms if-13-46.icore1.HK2- HongKong.as6453.net [116.0.67.17] 10 40 ms 35 ms 36 ms Vlan32.icore1.S9U- Singapore.as6453.net [116.0.83.1] 11 32 ms 32 ms 32 ms ix-12-3.icore1.S9U- Singapore.as6453.net [116.0.83.70] 12 * * * Request timed out. 13 * * * Request timed out. 14 33 ms 33 ms 33 ms 203.83.223.83 15 33 ms 33 ms 33 ms 204.246.164.22 Tokyo Singapore Hong Kong
  6. 6. Singapore DNS Resolver Hong Kong TCP Connect 5.6.7.8 HTTP/1.1 GET /example.jpg DNS response d123.cloudfront.net 5.6.7.8 DNS query d123.cloudfront.net Routing Engine Maps Resolvers/Viewer Networks => Edge Location Tokyo 5.6.7.8 Anonymous Latency measurements from real users
  7. 7. *NavURL = http://pfc303.origin-v.jman.ws
  8. 8. {{ my_url_for('static', filename='0001.css') }} xmlhttp0.open("GET","ajax?num=10",true); …{{ s }}
  9. 9. Test instance Origin
  10. 10. 0 0.1 0.2 0.3 0.4 0.5 0.6 1 3 5 7 9 11 13 15 17 19 Page Load Time (s) Test Iteration Virginia -Baseline Virginia - Baseline 0.4 0.9 1.4 1.9 2.4 2.9 3.4 3.9 4.4 1 3 5 7 9 11 13 15 17 19 Page Load Time (s) Test Iteration Oregon -Baseline Oregon - Baseline 9 9.1 9.2 9.3 9.4 9.5 9.6 9.7 9.8 9.9 10 1 3 5 7 9 11 13 15 17 19 Page Load Time (s) Test Iteration Tokyo -Baseline Tokyo - Baseline
  11. 11. 0.4 0.9 1.4 1.9 2.4 2.9 3.4 3.9 4.4 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Page Load Time (s) Test Iteration Oregon - Baseline Oregon - Static CDN 0 2 4 6 8 10 12 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Page Load Time (s) Test Iteration Tokyo - Baseline Tokyo - Static CDN
  12. 12. http://pfc303.cdn-v.jman.ws/ defadd_header(response): response.cache_control.max_age= 300 return response *NavURL = http://pfc303.origin-v.jman.ws
  13. 13. Caching Origin Edge Location User Request A
  14. 14. Caching Origin Edge Location Get Image User Request A
  15. 15. Caching Origin Edge Location Get Image Get Image User Request A
  16. 16. Caching Origin Edge Location Get Image Get Image Image User Request A
  17. 17. Caching Origin Edge Location Get Image Get Image Image Image User Request A
  18. 18. Caching Origin Edge Location User Request B Get Image
  19. 19. Caching Origin Edge Location Image Get Image User Request B
  20. 20. 0 0.5 1 1.5 2 2.5 3 3.5 4 1 2 3 Page Load Time (s) Test Iteration Oregon - Static CDN Oregon - Whole Site 0 0.2 0.4 0.6 0.8 1 1.2 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Page Load Time (s) Test Iteration Oregon - Static CDN Oregon - Whole Site
  21. 21. 0 2 4 6 8 10 12 1 2 3 Page Load Time (s) Test Iteration Tokyo - Static CDN Tokyo - Whole Site 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Page Load Time (s) Test Iteration Tokyo - Static CDN Tokyo - Whole Site
  22. 22. _static = 'static/' response.cache_control.max_age= 0 response.cache_control.max_age= 300 if response.mimetype!= 'text/html': *NavURL = http://pfc303.cdn-v.jman.ws CloudFront Origin = http://pfc303.origin-v.jman.ws
  23. 23. •HTTP runs on TCP/IP •TCP has the concept of TCP handshake •Every HTTP connection has to complete TCP handshake
  24. 24. Two Users Without an Edge Proxy SYN SYN-ACK ACK GET /index.jsp ACK SYN-ACK GET /index.jsp 2nd User Region SYN 100ms 200ms 200ms
  25. 25. With CloudFront as an Edge Proxy SYN SYN-ACK ACK GET /index.jsp ACK -ACK GET /index.jsp Region SYN 20ms SYN SYN-ACK ACK GET /index.jsp GET /index.jsp 80ms 2nd User 200ms 120ms
  26. 26. Window Size Optimization Packet1 Packet 1 ACK Packet 2 Packet 3 ACK Packet 3 Packet 4 Packet 5 Packet 6 Packet 7
  27. 27. Packet1 Packet 1 ACK Packet 2 Packet 3 ACK Packet 3 Packet 4 Packet 5 Packet 6 Packet 7 Packet1 Packet 2 Packet 4 ACK Packet 3 Packet 4 Packet 5 Packet 6 Packet 7 Packet 8 Packet 9 Window Size Optimization (Continued) Region
  28. 28. Test Instance Origin
  29. 29. 0 1 2 3 4 5 6 7 8 9 1 2 3 Page Load Time (s) Test Iteration Tokyo - Whole Site Tokyo - Multi-Region 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Page Load Time (s) Test Iteration Tokyo - Whole Site Tokyo - Multi-Region
  30. 30. 58
  31. 31. Test Instance Origin
  32. 32. Test Instance Origin
  33. 33. Test Instance Origin
  34. 34. Test Instance Origin
  35. 35. 0 0.5 1 1.5 2 2.5 3 3.5 4 1 2 3 Page Load Time (s) Test Iteration Oregon - Whole Site Oregon - Cache-able Base 0 0.2 0.4 0.6 0.8 1 1.2 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Page Load Time (s) Test Iteration Oregon - Whole Site Oregon - Cache-able Base
  36. 36. 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 1 2 3 Page Load Time (s) Test Iteration Tokyo - Multi-Region Tokyo - Cache-able Base 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Page Load Time (s) Test Iteration Tokyo - Multi-Region Tokyo - Cache-able Base
  37. 37. _static = 'static/' response.cache_control.max_age= 300 response.cache_control.max_age= 0 if response.mimetype!= 'text/html': *NavURL = http://pfc303.cdn.jman.ws CDN origin = http://pfc303.origin.jman.ws
  38. 38. 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Page Load Time (s) Test Iteration Oregon - Cache-able Base Oregon - Final 0 0.5 1 1.5 2 2.5 3 3.5 4 1 2 3 Page Load Time (s) Test Iteration Oregon - Cache-able Base Oregon - Final
  39. 39. 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 1 2 3 Page Load Time (s) Test Iteration Tokyo - Cache-able Base Tokyo - Final 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Page Load Time (s) Test Iteration Tokyo - Cache-able Base Tokyo - Final
  40. 40. Virginia -Baseline Virginia -Final % Improvement 1st Request 0.49s 0.43s 11.89% Avg of Requests 2-20 0.40s 0.28s 27.18% Oregon -Baseline Oregon -Final % Improvement 1st Request 3.50s 2.39s 31.75% Avg of Requests 2-20 3.47s 0.47s 86.82% Tokyo -Baseline Tokyo -Final % Improvement 1st Request 9.93s 2.32s 76.68% Avg of Requests 2-20 9.53s 0.46s 95.99% Tokyo -Final (Single Region) % Improvement 1st Request 4.88s 52.93% Avg of Requests 2-20 0.59s 93.60%
  41. 41. Please give us your feedback on this session. Complete session evaluations and earn re:Invent swag. http://bit.ly/awsevals

×