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

1. Tight security

2. High availability

3. High performance

Page 3: (PFC303) Milliseconds Matter: Design, Deploy, and Operate Your Application for Best Possible Performance | AWS re:Invent 2014
Page 4: (PFC303) Milliseconds Matter: Design, Deploy, and Operate Your Application for Best Possible Performance | AWS re:Invent 2014
Page 5: (PFC303) Milliseconds Matter: Design, Deploy, and Operate Your Application for Best Possible Performance | AWS re:Invent 2014
Page 6: (PFC303) Milliseconds Matter: Design, Deploy, and Operate Your Application for Best Possible Performance | AWS re:Invent 2014
Page 7: (PFC303) Milliseconds Matter: Design, Deploy, and Operate Your Application for Best Possible Performance | AWS re:Invent 2014

Data center/back bone measurements

Last-mile measurements

Synthetic real user measurements

Real user measurements

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

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 ms 203.208.249.242 2 <1 ms <1 ms <1 ms 203.208.232.54 3 <1 ms <1 ms <1 ms 203.208.232.34 4 4 ms 4 ms 4 ms 203.208.232.49 5 <1 ms <1 ms <1 ms 202.160.250.225 6 <1 ms <1 ms <1 ms ge-1-0-0-0.sngc3-dr1.ix.singtel.com [203.208.173.134] 7 <1 ms 10 ms <1 ms ge-4-1-0-0.sngc3-ar3.ix.singtel.com [203.208.172.170] 8 87 ms 97 ms 97 ms 59.128.15.141 9 87 ms 97 ms 97 ms otecbb103.kddnet.ad.jp [124.211.33.1] 10 98 ms 77 ms 90 ms otejbb203.kddnet.ad.jp [59.128.4.61] 11 87 ms 88 ms 89 ms cm-ote252.kddnet.ad.jp [59.128.7.209] 12 77 ms 88 ms 77 ms 118.155.202.30 13 98 ms 87 ms 98 ms ns-01.cloudfront.net [207.171.170.1]

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

SingaporeTokyoDNS 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

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

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

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

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

Page 16: (PFC303) Milliseconds Matter: Design, Deploy, and Operate Your Application for Best Possible Performance | AWS re:Invent 2014
Page 17: (PFC303) Milliseconds Matter: Design, Deploy, and Operate Your Application for Best Possible Performance | AWS re:Invent 2014
Page 18: (PFC303) Milliseconds Matter: Design, Deploy, and Operate Your Application for Best Possible Performance | AWS re:Invent 2014
Page 19: (PFC303) Milliseconds Matter: Design, Deploy, and Operate Your Application for Best Possible Performance | AWS re:Invent 2014
Page 20: (PFC303) Milliseconds Matter: Design, Deploy, and Operate Your Application for Best Possible Performance | AWS re:Invent 2014
Page 21: (PFC303) Milliseconds Matter: Design, Deploy, and Operate Your Application for Best Possible Performance | AWS re:Invent 2014
Page 22: (PFC303) Milliseconds Matter: Design, Deploy, and Operate Your Application for Best Possible Performance | AWS re:Invent 2014
Page 23: (PFC303) Milliseconds Matter: Design, Deploy, and Operate Your Application for Best Possible Performance | AWS re:Invent 2014

*Nav URL = http://pfc303.origin-v.jman.ws

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

{{ my_url_for('static', filename='0001.css') }}

xmlhttp0.open("GET","ajax?num=10",true);

…{{ s }}

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

Test instance

Origin

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

0

0.1

0.2

0.3

0.4

0.5

0.6

1 3 5 7 9 11 13 15 17 19

Pag

e L

oad

Tim

e (

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

Pag

e L

oad

Tim

e (

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

Pag

e L

oad

Tim

e (

s)

Test Iteration

Tokyo - Baseline

Tokyo - Baseline

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

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

Pag

e L

oad

Tim

e (

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

Pag

e L

oad

Tim

e (

s)

Test Iteration

Tokyo - Baseline Tokyo - Static CDN

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

http://pfc303.cdn-v.jman.ws/

def add_header(response):

response.cache_control.max_age = 300

return response*Nav URL = http://pfc303.origin-v.jman.ws

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

Caching

Origin

Edge

Location

User Request A

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

Caching

Origin

Edge

Location

Get Image

User Request A

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

Caching

Origin

Edge

Location

Get Image

Get Image

User Request A

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

Caching

Origin

Edge

Location

Get Image

Get Image

Image

User Request A

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

Caching

Origin

Edge

Location

Get Image

Get Image

Image

Image

User Request A

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

Caching

Origin

Edge

Location

User Request B

Get Image

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

Caching

Origin

Edge

LocationGet ImageImage

User Request B

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

0

0.5

1

1.5

2

2.5

3

3.5

4

1 2 3

Pag

e L

oad

Tim

e (

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

Pag

e L

oad

Tim

e (

s)

Test Iteration

Oregon - Static CDN Oregon - Whole Site

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

0

2

4

6

8

10

12

1 2 3

Pag

e L

oad

Tim

e (

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

Pag

e L

oad

Tim

e (

s)

Test Iteration

Tokyo - Static CDN Tokyo - Whole Site

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

_static = 'static/'

response.cache_control.max_age = 0

response.cache_control.max_age = 300

if response.mimetype != 'text/html':

*Nav URL = http://pfc303.cdn-v.jman.ws

CloudFront Origin = http://pfc303.origin-v.jman.ws

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

• HTTP runs on TCP/IP

• TCP has the concept of TCP handshake

• Every HTTP connection has to complete TCP

handshake

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

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

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

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

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

Window Size Optimization

Packet1

Packet 1 ACK

Packet 2

Packet 3 ACK

Packet 3

Packet 4

Packet 5

Packet 6

Packet 7

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

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

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

Test Instance

Origin

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

0

1

2

3

4

5

6

7

8

9

1 2 3

Pag

e L

oad

Tim

e (

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

Pag

e L

oad

Tim

e (

s)

Test Iteration

Tokyo - Whole Site Tokyo - Multi-Region

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

58

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

Test Instance

Origin

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

Test Instance

Origin

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

Test Instance

Origin

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

Test Instance

Origin

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

0

0.5

1

1.5

2

2.5

3

3.5

4

1 2 3

Pag

e L

oad

Tim

e (

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

Pag

e L

oad

Tim

e (

s)

Test Iteration

Oregon - Whole Site Oregon - Cache-able Base

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

0

0.5

1

1.5

2

2.5

3

3.5

4

4.5

1 2 3

Pag

e L

oad

Tim

e (

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

Pag

e L

oad

Tim

e (

s)

Test Iteration

Tokyo - Multi-Region Tokyo - Cache-able Base

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

_static = 'static/'

response.cache_control.max_age = 300

response.cache_control.max_age = 0

if response.mimetype != 'text/html':

*Nav URL = http://pfc303.cdn.jman.ws

CDN origin = http://pfc303.origin.jman.ws

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

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

Pag

e L

oad

Tim

e (

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

Pag

e L

oad

Tim

e (

s)

Test Iteration

Oregon - Cache-able Base Oregon - Final

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

0

0.5

1

1.5

2

2.5

3

3.5

4

4.5

1 2 3

Pag

e L

oad

Tim

e (

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

Pag

e L

oad

Tim

e (

s)

Test Iteration

Tokyo - Cache-able Base Tokyo - Final

Page 73: (PFC303) Milliseconds Matter: Design, Deploy, and Operate Your Application for Best Possible Performance | AWS re:Invent 2014
Page 74: (PFC303) Milliseconds Matter: Design, Deploy, and Operate Your Application for Best Possible Performance | AWS re:Invent 2014
Page 75: (PFC303) Milliseconds Matter: Design, Deploy, and Operate Your Application for Best Possible Performance | AWS re:Invent 2014
Page 76: (PFC303) Milliseconds Matter: Design, Deploy, and Operate Your Application for Best Possible Performance | AWS re:Invent 2014
Page 77: (PFC303) Milliseconds Matter: Design, Deploy, and Operate Your Application for Best Possible Performance | AWS re:Invent 2014
Page 78: (PFC303) Milliseconds Matter: Design, Deploy, and Operate Your Application for Best Possible Performance | AWS re:Invent 2014

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%

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

Please give us your feedback on this session.

Complete session evaluations and earn re:Invent swag.

http://bit.ly/awsevals