Top Banner
Alessandro Nadalin | NAMSHI.com http://end.of.the.road?
141

HTTP colon slash slash: the end of the road?

May 08, 2015

Download

Technology

Presentation given at the International PHP conference in Mainz, October 2012, dealing with a bit of history about the HTTP protocol, SPDY and the future (HTTP/2.0).
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: HTTP colon slash slash: the end of the road?

Alessandro Nadalin | NAMSHI.com

http://end.of.the.road?

Page 2: HTTP colon slash slash: the end of the road?

AGENDA

. History of HTTP. Hidden features

. HTTP/2.0. SPDY

Page 3: HTTP colon slash slash: the end of the road?

HTTP/X.Y ?

Page 4: HTTP colon slash slash: the end of the road?

Web development?

Page 5: HTTP colon slash slash: the end of the road?

Web development?

WWW

Page 6: HTTP colon slash slash: the end of the road?

Web development?

WWW

Clients

Page 7: HTTP colon slash slash: the end of the road?

Web development?

WWW

Clients

Servers

Page 8: HTTP colon slash slash: the end of the road?

Web development?

WWW

Clients

Server

M2M

Servers

Page 9: HTTP colon slash slash: the end of the road?

Web development?

WWW

Clients

Servers

M2M

ServersAutomation

Page 10: HTTP colon slash slash: the end of the road?

Any user can easilyinteract with a

Webpage.

Page 11: HTTP colon slash slash: the end of the road?

( except my mom )

Page 12: HTTP colon slash slash: the end of the road?

What about machines?

Page 13: HTTP colon slash slash: the end of the road?

They need rules.

Page 14: HTTP colon slash slash: the end of the road?

They need rules.

verbs

Page 15: HTTP colon slash slash: the end of the road?

They need rules.

verbs

domains

Page 16: HTTP colon slash slash: the end of the road?

They need rules.

verbs

domains

workflows

Page 17: HTTP colon slash slash: the end of the road?

They need rules.

verbs

domains

workflows

logic

Page 18: HTTP colon slash slash: the end of the road?

They need rules.

verbs

domains

workflows

logic

constraints

Page 19: HTTP colon slash slash: the end of the road?

PROTOCOLS

Page 20: HTTP colon slash slash: the end of the road?

HTTP/0.9

Page 21: HTTP colon slash slash: the end of the road?

HTTP/0.9(1991)

Page 22: HTTP colon slash slash: the end of the road?

HTTP/1.0

Page 23: HTTP colon slash slash: the end of the road?

Tim Berners-Lee

Roy Fielding

GET

separate connections

POST

HEAD

1996

Page 24: HTTP colon slash slash: the end of the road?

HTTP/1.1

Page 25: HTTP colon slash slash: the end of the road?

Tim Berners-Lee

Roy Fielding

GET

separate connections

POST

HEAD

1996TRACE

OPTIONS

PUT

DELETE

PATCH

DIFF

Domain Application Protocol

Page 26: HTTP colon slash slash: the end of the road?

CACHEhttp://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html

CACHE CHANNELS

304 Not modified

EXPIRES

SCALABILITY

MAX-AGE

Page 27: HTTP colon slash slash: the end of the road?

<feed xmlns="http://www.w3.org/2005/Atom" xmlns:cc="http://purl.org/syndication/cache-channel"> <title>Invalidations for www.example.org</title> <id>http://admin.example.org/events/</id> <link rel="self" href="http://admin.example.org/events/current"/> <link rel="prev-archive" href="http://admin.example.org/events/archive/1234"/> <updated>2007-04-13T11:23:42Z</updated> <author> <name>Administrator</name> <email>[email protected]</email> </author> <cc:precision>60</cc:precision> <cc:lifetime>2592000</cc:lifetime> <entry> <title>stale</title> <id>http://admin.example.org/events/1124</id> <updated>2007-04-13T11:23:42Z</updated> <link href="urn:uuid:50D3565C-97A8-40E1-A5C8-CFA070166FEF"/> <cc:stale/> </entry> <entry> <title>stale</title> <id>http://admin.example.org/events/1125</id> <updated>2007-04-13T10:31:01Z</updated> <link href="http://www.example.org/img/123.gif" type="image/gif"/> <link href="http://www.example.org/img/123.png" type="image/png"/> <cc:stale/> </entry> </feed>

Page 28: HTTP colon slash slash: the end of the road?

GET /users/1 HTTP/1.1Host: example.com

HTTP/1.1 200 OkEtag: 123abc

GET /users/1 HTTP/1.1Host: example.comIf-None-Match: 123abc

HTTP/1.1 304 Not Modified

POST /users/1 HTTP/1.1Host: example.comEtag: 123abcdefgh...

HTTP/1.1 412Precondition Failed

Page 29: HTTP colon slash slash: the end of the road?

GET /users/1 HTTP/1.1Host: example.com

HTTP/1.1 200 OkCache-Control: max-age=60

GET /users/1 HTTP/1.1Host: example.com

Page 30: HTTP colon slash slash: the end of the road?

FOR FREE

Page 31: HTTP colon slash slash: the end of the road?

and here are a few ways to do so, using

expiration

validation

invalidation

Page 32: HTTP colon slash slash: the end of the road?

Expiration

Page 33: HTTP colon slash slash: the end of the road?

GET / HTTP/1.1Host: www.example.comExpires: 0

Page 34: HTTP colon slash slash: the end of the road?

GET / HTTP/1.1Host: www.example.comExpires: 0

Page 35: HTTP colon slash slash: the end of the road?

GET / HTTP/1.1Host: www.example.comExpires: Tue, 15 Nov 1994 01:00 GMT

Page 36: HTTP colon slash slash: the end of the road?

GET / HTTP/1.1Host: www.example.comCache-Control: max-age=60, public

Page 37: HTTP colon slash slash: the end of the road?

GET / HTTP/1.1Host: www.example.comCache-Control: max-age=60, public

Page 38: HTTP colon slash slash: the end of the road?

GET / HTTP/1.1Host: www.example.comCache-Control: max-age=60, public

Cacheable for 60 seconds

Page 39: HTTP colon slash slash: the end of the road?

GET / HTTP/1.1Host: www.example.comCache-Control: max-age=60, public

Cacheable by both local and shared caches

Page 40: HTTP colon slash slash: the end of the road?

GET / HTTP/1.1Host: www.example.comCache-Control: stale-if-error=600, stale-while-revalidate=600

Page 41: HTTP colon slash slash: the end of the road?

GET / HTTP/1.1Host: www.example.comCache-Control: stale-if-error=600, stale-while-revalidate=600

fault-tolerant

Page 42: HTTP colon slash slash: the end of the road?

GET / HTTP/1.1Host: www.example.comCache-Control: stale-if-error=600, stale-while-revalidate=600

available during downtime

Page 43: HTTP colon slash slash: the end of the road?

GET / HTTP/1.1Host: www.example.comCache-Control: stale-if-error=600, stale-while-revalidate=600

available during revalidation

Page 44: HTTP colon slash slash: the end of the road?

Validation

Page 45: HTTP colon slash slash: the end of the road?

GET / HTTP/1.1Host: www.example.comEtag: 1234

Page 46: HTTP colon slash slash: the end of the road?

GET / HTTP/1.1Host: www.example.comEtag: 1234

an identifier for your response

Page 47: HTTP colon slash slash: the end of the road?

GET / HTTP/1.1Host: www.example.comIf-None-Match: 1234

the browsers asks you if it has been modified

Conditional requests

Page 48: HTTP colon slash slash: the end of the road?

Relax

Page 49: HTTP colon slash slash: the end of the road?

Calculating an Etag is cheaper than generating a full MVC response

Page 50: HTTP colon slash slash: the end of the road?

HTTP/1.1 304 Not Modified

Page 51: HTTP colon slash slash: the end of the road?

GET / HTTP/1.1Host: www.example.comLast-Modified: Tue, 15 Jan 2011 12:00:00 GMT

Page 52: HTTP colon slash slash: the end of the road?

GET / HTTP/1.1Host: www.example.comLast-Modified: Tue, 15 Jan 2011 12:00:00 GMT

tell the client about the latest change

Page 53: HTTP colon slash slash: the end of the road?

GET / HTTP/1.1Host: www.example.comIf-Modified-Since: Tue, 15 Jan 2011 12:00:00 GMT

the client asks you if it has been modified since the last time

Conditional requests

Page 54: HTTP colon slash slash: the end of the road?

Relax

Page 55: HTTP colon slash slash: the end of the road?

Calculating a date is cheaper than retrieving an entire object

Page 56: HTTP colon slash slash: the end of the road?

HTTP/1.1 304 Not Modified

Page 57: HTTP colon slash slash: the end of the road?

Invalidation

Page 58: HTTP colon slash slash: the end of the road?

The web is not meant for invalidating data.

Server should not be able to keep clients' state, otherwise they wont scale well.

That's why long-polling and endless connections haven't had big success dealing with caching.

Page 59: HTTP colon slash slash: the end of the road?

but hey, you say

Page 60: HTTP colon slash slash: the end of the road?

HTTP's cache fails when dealing with really dynamic pages, because consumers will always have to hit the

origin server, although a part of the page would be cacheable ( header and footer, for example )

Page 61: HTTP colon slash slash: the end of the road?

Nope

Nope

Page 62: HTTP colon slash slash: the end of the road?

ESI was built for thathttp://www.w3.org/TR/esi-lang

Page 63: HTTP colon slash slash: the end of the road?

HInclude was built for thathttp://mnot.github.com/hinclude/

Page 64: HTTP colon slash slash: the end of the road?

So what does HTTP cache is meant to solve?

Page 65: HTTP colon slash slash: the end of the road?

Less work

Page 66: HTTP colon slash slash: the end of the road?

because the hard work is delegated to the browser/proxy

http://www.flickr.com/photos/snakphotography/5004775320/sizes/o/in/photostream/

Page 67: HTTP colon slash slash: the end of the road?

evolve

Page 68: HTTP colon slash slash: the end of the road?

because cache is abstracted from the application

Page 69: HTTP colon slash slash: the end of the road?

loose coupling

Page 70: HTTP colon slash slash: the end of the road?

because caching is bound to the protocol, HTTP, not to your implementation ( Sf, RoR, Django )

Page 71: HTTP colon slash slash: the end of the road?

it all started

Page 72: HTTP colon slash slash: the end of the road?

21

Page 73: HTTP colon slash slash: the end of the road?

years

Page 74: HTTP colon slash slash: the end of the road?

ago

Page 75: HTTP colon slash slash: the end of the road?

Damn.

Page 76: HTTP colon slash slash: the end of the road?

HTTP/2.0

Page 77: HTTP colon slash slash: the end of the road?

Nothing to see here.

Page 78: HTTP colon slash slash: the end of the road?

SPDY

Page 79: HTTP colon slash slash: the end of the road?
Page 81: HTTP colon slash slash: the end of the road?

You're already using it

Page 82: HTTP colon slash slash: the end of the road?
Page 83: HTTP colon slash slash: the end of the road?
Page 84: HTTP colon slash slash: the end of the road?
Page 85: HTTP colon slash slash: the end of the road?

HTTP on steroids

Page 86: HTTP colon slash slash: the end of the road?

Requests prioritization

Page 87: HTTP colon slash slash: the end of the road?

Client Server

Page 88: HTTP colon slash slash: the end of the road?

Client Server

Page 89: HTTP colon slash slash: the end of the road?

Client Server

Page 90: HTTP colon slash slash: the end of the road?

Client Server

Page 91: HTTP colon slash slash: the end of the road?

Compression

Page 92: HTTP colon slash slash: the end of the road?

Extended compression

Page 93: HTTP colon slash slash: the end of the road?

Multiplexing

Page 94: HTTP colon slash slash: the end of the road?

Client Server

R/R model

Page 95: HTTP colon slash slash: the end of the road?

Client Server

R/R model

Page 96: HTTP colon slash slash: the end of the road?

Client Server

R/R model

Page 97: HTTP colon slash slash: the end of the road?

Client Server

Pipelining

Page 98: HTTP colon slash slash: the end of the road?

Client Server

Pipelining

Page 99: HTTP colon slash slash: the end of the road?

Client Server

Multiplexing

Page 100: HTTP colon slash slash: the end of the road?

Client Server

Multiplexing

Page 101: HTTP colon slash slash: the end of the road?

Client Server

Multiplexing

Page 102: HTTP colon slash slash: the end of the road?

Server push

Page 103: HTTP colon slash slash: the end of the road?

Result?

Page 104: HTTP colon slash slash: the end of the road?
Page 105: HTTP colon slash slash: the end of the road?

SPDY

Page 106: HTTP colon slash slash: the end of the road?

SPDY

HTTP

Page 107: HTTP colon slash slash: the end of the road?

Not-so-side effect?

Page 108: HTTP colon slash slash: the end of the road?

13 years later...

Page 109: HTTP colon slash slash: the end of the road?

HTTP/2.0

Page 110: HTTP colon slash slash: the end of the road?
Page 111: HTTP colon slash slash: the end of the road?

Based on?

Page 112: HTTP colon slash slash: the end of the road?

SPDYhttp://lists.w3.org/Archives/Public/ietf-http-wg/2012OctDec/0004.html

http://www.slideshare.net/mnot/what-http20-will-do-for-you

Page 113: HTTP colon slash slash: the end of the road?

Which is based on?

Page 114: HTTP colon slash slash: the end of the road?

HTTP/1.1

Page 115: HTTP colon slash slash: the end of the road?

SPDY doesnt change the protocol,it just changes the way messages are

exchanged over the wire

Page 116: HTTP colon slash slash: the end of the road?

Semantics are the same.

Page 117: HTTP colon slash slash: the end of the road?

Workflows are the same.

Page 118: HTTP colon slash slash: the end of the road?

Verbs are the same.

Page 119: HTTP colon slash slash: the end of the road?

The interface is the same.

Page 120: HTTP colon slash slash: the end of the road?

And HTTP/1.1 is based on?

Page 121: HTTP colon slash slash: the end of the road?

HTTP/1.0

Page 122: HTTP colon slash slash: the end of the road?

15

Page 123: HTTP colon slash slash: the end of the road?

damn

Page 124: HTTP colon slash slash: the end of the road?

years

Page 125: HTTP colon slash slash: the end of the road?

Ago

Page 126: HTTP colon slash slash: the end of the road?

PERIOD.

Page 127: HTTP colon slash slash: the end of the road?

An architecture that lasts 20 years is possible.

Page 128: HTTP colon slash slash: the end of the road?

( REST )

Page 129: HTTP colon slash slash: the end of the road?

You?

Page 130: HTTP colon slash slash: the end of the road?

Alex Nadalin

Page 131: HTTP colon slash slash: the end of the road?

Alex Nadalinodino.org

Page 132: HTTP colon slash slash: the end of the road?

Alex Nadalin

@_odino_

odino.org

Page 133: HTTP colon slash slash: the end of the road?

Alex Nadalin

@_odino_

odino.org

Page 134: HTTP colon slash slash: the end of the road?

Alex Nadalin

@_odino_

odino.org

Page 135: HTTP colon slash slash: the end of the road?

Alex Nadalin

@_odino_

odino.org DXB

Page 136: HTTP colon slash slash: the end of the road?

Alex Nadalin

@_odino_

odino.org DXB

Page 137: HTTP colon slash slash: the end of the road?

We're hiring!

Page 138: HTTP colon slash slash: the end of the road?

In Dubai.

Page 139: HTTP colon slash slash: the end of the road?

In Dubai.

[email protected]

Page 140: HTTP colon slash slash: the end of the road?

In Dubai.

[email protected]

@_odino_

Page 141: HTTP colon slash slash: the end of the road?

In Dubai.

[email protected]

@_odino_

TALK TO ME!