http://end:of@the.road/?
CakeFest, San Francisco, Sep 2013
WARNING
NO
CAKEPHP
AHEAD
2ND WARNING
OLD
http://www.flickr.com/photos/leoheart/391958347/sizes/o/in/photostream/
AGENDA
. History of HTTP
. Hidden features
. HTTP/2.0
. SPDY
HTTP/X.Y ?
HTTP/1.1?
Web development?
Web development?
www
Clients
M2MServers
Automation
Any user can easily
interact with a
Webpage.
( except my mom )
What about machines?
They need rules.
www
Clients
M2MServers
Automation
logic
Web development?
Web development?
www
Clients
M2MServers
Automation
verbs
domains
workflows
logic
Web development?
www
Clients
M2MServers
Automation
verbs
domains
workflows
logic
constraints
PROTOCOLS
1991
HTTP/0.9
HTTP/1.0
Web development?
www
Clients
M2MServers
Automation
verbs
domains
workflows
logic
constraints
Web development?
www
Clients
M2MServers
Automation
verbs
domains
workflows
logic
constraints
Tim Berners-Lee
Roy Fielding
1996
Web development?
www
Clients
M2MServers
Automation
verbs
domains
workflows
logic
constraints
Tim Berners-Lee
Roy Fielding
GET
separate connections
POST
HEAD1996
HTTP/1.1
Web development?
www
Clients
M2MServers
Automation
verbs
domains
workflows
logic
constraints
Tim Berners-Lee
Roy Fielding
GET
separate connections
POST
HEAD1996
Web development?
www
Clients
M2MServers
Automation
verbs
domains
workflows
logic
constraints
Tim Berners-Lee
Roy Fielding
GET
separate connections
POST
HEAD1996 DIFF
PUT
DELETE
PATCH
TRACE
OPTIONS
Web development?
www
Clients
M2MServers
Automation
verbs
domains
workflows
logic
constraints
Tim Berners-Lee
Roy Fielding
GET
separate connections
POST
HEAD1996 DIFF
PUT
DELETE
PATCH
TRACE
OPTIONS
Web development?
www
Clients
M2MServers
Automation
verbs
domains
workflows
logic
constraints
Tim Berners-Lee
Roy Fielding
GET
separate connections
POST
HEAD1996 DIFF
PUT
DELETE
PATCH
TRACE
OPTIONS
Cache
CACHE
GET /users/1
HTTP/1.1
Host: example.com
HTTP/1.1 200 Ok
Etag: 123abc
GET /users/1 HTTP/1.1
Host: example.com
If-None-Match: 123abc
HTTP/1.1 304 Not
Modified
POST /users/1 HTTP/1.1
Host: example.com
Etag: 123abcdefgh
...
HTTP/1.1 412
Precondition Failed
GET /users/1 HTTP/1.1
Host: example.com
HTTP/1.1 200 Ok
Cache-Control: max-age=60
GET /users/1 HTTP/1.1
Host: example.com
FOR FREE
and here are a few ways to do
so, using
expiration
validation
invalidation
Expiration
GET / HTTP/1.1
Host: www.example.com
Expires: 0
GET / HTTP/1.1
Host: www.example.com
Expires: 0
GET / HTTP/1.1
Host: www.example.com
Expires: Tue, 15 Nov 1994 01:00 GMT
GET / HTTP/1.1
Host: www.example.com
Cache-Control: max-age=60, public
GET / HTTP/1.1
Host: www.example.com
Cache-Control: max-age=60, public
GET / HTTP/1.1
Host: www.example.com
Cache-Control: max-age=60, public
Cacheable for 60 seconds
GET / HTTP/1.1
Host: www.example.com
Cache-Control: max-age=60, public
Cacheable by both local and shared caches
GET / HTTP/1.1
Host: www.example.com
Cache-Control: stale-if-error=600, stale-while-revalidate=600
GET / HTTP/1.1
Host: www.example.com
Cache-Control: stale-if-error=600, stale-while-revalidate=600
fault-tolerant
GET / HTTP/1.1
Host: www.example.com
Cache-Control: stale-if-error=600, stale-while-revalidate=600
available during downtime
GET / HTTP/1.1
Host: www.example.com
Cache-Control: stale-if-error=600, stale-while-revalidate=600
available during revalidation
Validation
GET / HTTP/1.1
Host: www.example.
com
Etag: 1234
GET / HTTP/1.1
Host: www.example.
com
Etag: 1234
an identifier for your response
GET / HTTP/1.1
Host: www.example.
com
If-None-Match: 1234
the browsers asks you if it has been modified
Conditional requests
Relax
Calculating an Etag is cheaper than generating a full MVC
response
HTTP/1.1 304 Not Modified
GET / HTTP/1.1
Host: www.example.com
Last-Modified: Tue, 15 Jan 2011 12:00:00 GMT
GET / HTTP/1.1
Host: www.example.com
Last-Modified: Tue, 15 Jan 2011 12:00:00 GMT
tell the client about the latest change
GET / HTTP/1.1
Host: www.example.com
If-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
Relax
Calculating a date is cheaper than retrieving an entire object
HTTP/1.1 304 Not Modified
but hey, you say
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 )
Nope
ESI was built for that
http://www.w3.org/TR/esi-lang
HInclude was built for that
http://mnot.github.com/hinclude/
So what does HTTP cache is meant to solve?
Less work
because the hard work is delegated to the browser/proxy
http://www.flickr.com/photos/snakphotography/5004775320/sizes/o/in/photostream/
evolve
because cache is abstracted from the application
loose coupling
because caching is bound to the protocol, HTTP,
not to your implementation ( Sf, RoR, Django )
We’ve just ignored it
so far
for 22 years
HTTP/2.0
Nothing to see here.
SPDY
http://dev.chromium.org/spdy/spdy-whitepaper
You're already using it
HTTP on steroids
Requests prioritization
Client Server
Client Server
Client Server
Client Server
Compression
Extended compression
Multiplexing
Client Server
R/R model
Client Server
R/R model
Client Server
R/R model
Client Server
Pipelining
Client Server
Pipelining
Client Server
Multiplexing
Client Server
Multiplexing
Client Server
Multiplexing
Server push
Result?
Not-so-side effect?
14 years later...
HTTP/2.0
https://github.com/http2/http2-spec
http://tools.ietf.org/html/draft-ietf-httpbis-http2-04
GET /index.html HTTP/1.1
Host: www.example.com
SURPRISE!
it will be a binary protocol
http://tech.slashdot.org/story/13/07/09/1455200/http-20-will-be-a-binary-protocol
00 39 01 05 00 00 00 01 84 83
42 11 77 77 77 2e 67 6f 6f 67
6c 65 2e 63 6f 6d 3a 38 30 4c
0d 6d 79 2d 75 73 65 72 2d 61
67 65 6e 74 40 0d 78 2d 73 6f
6d 65 2d 68 65 61 64 65 72 05
66 69 72 73 74
Improved performances
http://www.itnews.com.au/News/349694,next-version-of-hyper-text-protocol-to-be-binary.aspx
GET /default.htm HTTP/1.1
Host: server.example.com
Connection: Upgrade, HTTP2-Settings
Upgrade: HTTP/2.0
HTTP2-Settings: <base64url-encoded HTTP/2.0 settings>
GET /default.htm HTTP/1.1
Host: server.example.com
Connection: Upgrade, HTTP2-Settings
Upgrade: HTTP/2.0
HTTP2-Settings: <base64url-encoded HTTP/2.0 settings>
Based on?
SPDY
http://lists.w3.org/Archives/Public/ietf-http-wg/2012OctDec/0004.html
http://www.slideshare.net/mnot/what-http20-will-do-for-you
Which is based on?
HTTP/1.1
SPDY doesnt change the protocol,
it just changes the way messages are
exchanged over the wire
Semantics are the same.
Workflows are the same.
Verbs are the same.
The interface is the same.
“The minimum bar to entry for replacing
HTTP/1.1 is to exactly support its semantics
and capabilities, while making it more
efficient”
Mark Nottingham
http://www.mnot.net/blog/2009/11/13/flip
And HTTP/1.1 is based on?
HTTP/1.0
Published 17 years ago
An architecture that lasts 20 years is possible.
( REST )
...yawn...
Alessandro Nadalin
Alessandro Nadalin
@_odino_
Alessandro Nadalin
@_odino_
Namshi | Rocket Internet
Alessandro Nadalin
@_odino_
Namshi | Rocket Internet
VP Technology
Alessandro Nadalin
@_odino_
Namshi | Rocket Internet
VP Technology
odino.org
Thanks!
Alessandro Nadalin
@_odino_
Namshi | Rocket Internet
VP Technology
odino.org

HTTP colon slash slash: end of the road? @ CakeFest 2013 in San Francisco