powerpoint presentation · based on google’s spdy protocol published as proposed standard on feb....

25
HTTP/2 HTTP/2 frank

Upload: others

Post on 27-Mar-2020

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: PowerPoint Presentation · Based on Google’s SPDY Protocol Published as proposed standard on Feb. 17, 2015 RFC 7540 No change to HTTP semantics only how it transfers on wire Binary

HTTP/2HTTP/2

frank

Page 2: PowerPoint Presentation · Based on Google’s SPDY Protocol Published as proposed standard on Feb. 17, 2015 RFC 7540 No change to HTTP semantics only how it transfers on wire Binary

Com

pu

ter C

en

ter, C

S, N

CTU

2

What is HTTP/2?What is HTTP/2?

Next generation HTTP

Based on Google’s SPDY Protocol

Published as proposed standard on Feb. 17, 2015

RFC 7540

No change to HTTP semantics only how it transfers on wire

Binary instead of textual

Page 3: PowerPoint Presentation · Based on Google’s SPDY Protocol Published as proposed standard on Feb. 17, 2015 RFC 7540 No change to HTTP semantics only how it transfers on wire Binary

Com

pu

ter C

en

ter, C

S, N

CTU

3

Why HTTP/2?Why HTTP/2?

Still manipulate HTTP• HTTP methods

• Status codes

• URIs

• Header fields

Reduce page load latency• Multiplexing over single TCP connection

• Header compression

• Server push

Less web optimization needed• No image spriting/CSS,JS bundling needed

• No inline resources

• No domain sharding

Page 4: PowerPoint Presentation · Based on Google’s SPDY Protocol Published as proposed standard on Feb. 17, 2015 RFC 7540 No change to HTTP semantics only how it transfers on wire Binary

Com

pu

ter C

en

ter, C

S, N

CTU

4

MultiplexingMultiplexing

HTTP/1.0• One request per TCP connection

• F*cking slow

HTTP/1.0 w/ Keep-Alive• Avoid frequent connection setup

• Allowing only one outstanding request at a time

Still blocks

HTTP/1.1 w/ pipelinging• Allow multiple ordered request

• HOL Blocking

Browsers support multiple connections• TCP needs warm up

• Multiple connections waste memory of routers

Page 5: PowerPoint Presentation · Based on Google’s SPDY Protocol Published as proposed standard on Feb. 17, 2015 RFC 7540 No change to HTTP semantics only how it transfers on wire Binary

Com

pu

ter C

en

ter, C

S, N

CTU

5

MultiplexingMultiplexing

HTTP/1.0

GET index.html

200 OK

Client Server

One request per TCP connection

Page 6: PowerPoint Presentation · Based on Google’s SPDY Protocol Published as proposed standard on Feb. 17, 2015 RFC 7540 No change to HTTP semantics only how it transfers on wire Binary

Com

pu

ter C

en

ter, C

S, N

CTU

6

MultiplexingMultiplexing

HTTP/1.0 with Keep-Alive

GET index.html

200 OK

Client Server

Allow multiple requests in one connection

GET 陳菊 .avi

200 OK

Page 7: PowerPoint Presentation · Based on Google’s SPDY Protocol Published as proposed standard on Feb. 17, 2015 RFC 7540 No change to HTTP semantics only how it transfers on wire Binary

Com

pu

ter C

en

ter, C

S, N

CTU

7

MultiplexingMultiplexing

HTTP/1.0 with Keep-alive

GET index.html

200 OK

Client Server

Allow multiple request in on connection

However still blocksOnly one outstanding request

GET 陳菊 .avi

200 OK

Blocking

Blocking

Page 8: PowerPoint Presentation · Based on Google’s SPDY Protocol Published as proposed standard on Feb. 17, 2015 RFC 7540 No change to HTTP semantics only how it transfers on wire Binary

Com

pu

ter C

en

ter, C

S, N

CTU

8

MultiplexingMultiplexing

HTTP/1.1 with pipelining

GET index.html

200 OK

Client Server

Multiple ordered request

GET 陳菊 .avi

200 OK

200 OK

GET cutefrank.png

Page 9: PowerPoint Presentation · Based on Google’s SPDY Protocol Published as proposed standard on Feb. 17, 2015 RFC 7540 No change to HTTP semantics only how it transfers on wire Binary

Com

pu

ter C

en

ter, C

S, N

CTU

9

MultiplexingMultiplexing

HTTP/1.1 with pipelining

GET index.html

200 OK

Client Server

Head-Of-Line blockingSince request are serialised

GET 陳菊 .avi

200 OK

200 OK

GET cutefrank.png

Page 10: PowerPoint Presentation · Based on Google’s SPDY Protocol Published as proposed standard on Feb. 17, 2015 RFC 7540 No change to HTTP semantics only how it transfers on wire Binary

Com

pu

ter C

en

ter, C

S, N

CTU

10

MultiplexingMultiplexing

Browsers support parallel http requests

Page 11: PowerPoint Presentation · Based on Google’s SPDY Protocol Published as proposed standard on Feb. 17, 2015 RFC 7540 No change to HTTP semantics only how it transfers on wire Binary

Com

pu

ter C

en

ter, C

S, N

CTU

11

MultiplexingMultiplexing

HTTP/2 is stream-based.• Multiple concurrently open streams on one single connection

• Either endpoint interleaving frames from multiple streams

• Prioritized stream Important resources are responded first

Page 12: PowerPoint Presentation · Based on Google’s SPDY Protocol Published as proposed standard on Feb. 17, 2015 RFC 7540 No change to HTTP semantics only how it transfers on wire Binary

Com

pu

ter C

en

ter, C

S, N

CTU

12

MultiplexingMultiplexing

Page 13: PowerPoint Presentation · Based on Google’s SPDY Protocol Published as proposed standard on Feb. 17, 2015 RFC 7540 No change to HTTP semantics only how it transfers on wire Binary

Com

pu

ter C

en

ter, C

S, N

CTU

13

MultiplexingMultiplexing

HTTP/1.1

HTTP/2

Page 14: PowerPoint Presentation · Based on Google’s SPDY Protocol Published as proposed standard on Feb. 17, 2015 RFC 7540 No change to HTTP semantics only how it transfers on wire Binary

Com

pu

ter C

en

ter, C

S, N

CTU

14

Common HTTP/1.x OptimizationCommon HTTP/1.x Optimization

Image spriting

Small Resource Inlining

JS/CSS Bundling

•Not needed anymore

Page 15: PowerPoint Presentation · Based on Google’s SPDY Protocol Published as proposed standard on Feb. 17, 2015 RFC 7540 No change to HTTP semantics only how it transfers on wire Binary

Com

pu

ter C

en

ter, C

S, N

CTU

15

Domain sharding• Multiplexing makes multiple connections unnecessary

• We get TCP connection “warm” as quickly as possible, and keep it there

Common HTTP/1.x OptimizationCommon HTTP/1.x Optimization

Page 16: PowerPoint Presentation · Based on Google’s SPDY Protocol Published as proposed standard on Feb. 17, 2015 RFC 7540 No change to HTTP semantics only how it transfers on wire Binary

Com

pu

ter C

en

ter, C

S, N

CTU

16

Header compressionHeader compression

Page 17: PowerPoint Presentation · Based on Google’s SPDY Protocol Published as proposed standard on Feb. 17, 2015 RFC 7540 No change to HTTP semantics only how it transfers on wire Binary

Com

pu

ter C

en

ter, C

S, N

CTU

17

Header compressionHeader compression

Page 18: PowerPoint Presentation · Based on Google’s SPDY Protocol Published as proposed standard on Feb. 17, 2015 RFC 7540 No change to HTTP semantics only how it transfers on wire Binary

Com

pu

ter C

en

ter, C

S, N

CTU

18

Header compressionHeader compression

Page 19: PowerPoint Presentation · Based on Google’s SPDY Protocol Published as proposed standard on Feb. 17, 2015 RFC 7540 No change to HTTP semantics only how it transfers on wire Binary

Com

pu

ter C

en

ter, C

S, N

CTU

19

Header compressionHeader compression

Page 20: PowerPoint Presentation · Based on Google’s SPDY Protocol Published as proposed standard on Feb. 17, 2015 RFC 7540 No change to HTTP semantics only how it transfers on wire Binary

Com

pu

ter C

en

ter, C

S, N

CTU

20

Header compressionHeader compression

Headers are sent in every request

Too many redundant bytes in HTTP header• Request URI

• User-Agent

• Cookies

• Referer

Page 21: PowerPoint Presentation · Based on Google’s SPDY Protocol Published as proposed standard on Feb. 17, 2015 RFC 7540 No change to HTTP semantics only how it transfers on wire Binary

Com

pu

ter C

en

ter, C

S, N

CTU

21

Server PushServer Push

Server push• Push resources to client’s cache upon request

• No further requests for resources needed

Page 22: PowerPoint Presentation · Based on Google’s SPDY Protocol Published as proposed standard on Feb. 17, 2015 RFC 7540 No change to HTTP semantics only how it transfers on wire Binary

Com

pu

ter C

en

ter, C

S, N

CTU

22

Server PushServer Push

Without server push

GET index.html

Push CSS

Client Server

Server building pageNetwork idle

Request for resourcesRequest for resources

Push JS

Push Images

Page 23: PowerPoint Presentation · Based on Google’s SPDY Protocol Published as proposed standard on Feb. 17, 2015 RFC 7540 No change to HTTP semantics only how it transfers on wire Binary

Com

pu

ter C

en

ter, C

S, N

CTU

23

Server PushServer Push

With server push

GET index.html

200 OK

Client Server

Server building pageNetwork idle

Request for other resourcesRequest for other resources

Page 24: PowerPoint Presentation · Based on Google’s SPDY Protocol Published as proposed standard on Feb. 17, 2015 RFC 7540 No change to HTTP semantics only how it transfers on wire Binary

Com

pu

ter C

en

ter, C

S, N

CTU

24

Browser SupportBrowser Support

Page 25: PowerPoint Presentation · Based on Google’s SPDY Protocol Published as proposed standard on Feb. 17, 2015 RFC 7540 No change to HTTP semantics only how it transfers on wire Binary

Com

pu

ter C

en

ter, C

S, N

CTU

25

DeploymentDeployment

Nginx (starting from 1.9.5 release, 2015/9/22)

Apache2 (starting from 2.4.17 release, 2015,10,13)At the present you need to build apache24 from port with HTTP2=ON.

In httpd.conf:

server {listen 443 ssl http2;

ssl_certificate server.crt;ssl_certificate_key server.key;…

}

LoadModule http2_module libexec/apache24/mod_http2.so

# for a https serverProtocols h2 http/1.1# for a http serverProtocols h2c http/1.1