Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
SPDY and HTTP2
Search
Andreas Bjärlestam
March 15, 2013
Technology
1
1.1k
SPDY and HTTP2
Andreas Bjärlestam
March 15, 2013
Tweet
Share
More Decks by Andreas Bjärlestam
See All by Andreas Bjärlestam
Climate compensate with a pull request
bjarlestam
0
11
Agile performance testing
bjarlestam
0
99
SPDY or maybe HTTP2.0
bjarlestam
4
59
jquery mobile
bjarlestam
0
59
Devise - taking care of your users
bjarlestam
0
67
REST with JAX-RS
bjarlestam
1
88
REST
bjarlestam
2
150
Other Decks in Technology
See All in Technology
今日からできる!簡単 .NET 高速化 Tips -2024 edition-
xin9le
7
4.8k
モーダル間の変換後の一致性とジャンル表を用いた解釈可能性の考察 ~Text-to-MusicとText-To-ImageかつImage-to-Musicを例に~
otanet
0
320
実例で紹介するRAG導入時の知見と精度向上の勘所
yamahiro
7
2.4k
M5と自作基板をくっつけてみた〜M5 Japan Tour 2024 Spring 福冈 (Fukuoka|福岡)〜
keropiyo
1
250
Zero Data Loss Autonomous Recovery Service サービス概要
oracle4engineer
PRO
0
1.9k
QAエンジニアが伝えたい品質保証の羅針盤 / Compass for Quality Assurance
mii3king
1
170
Android Target SDK 35 (Android 15) 対応の概要
akkie76
0
200
「知的単純作業」を自動化する、地に足の着いた大規模言語モデル (LLM) の活用
nrryuya
8
6.4k
AWSに詳しくない人でも始められるコスト最適化ガイド
yuhta28
2
420
【SORACOM UG 東海】あらゆるモノがつながる社会へ、IoT と SORACOM
soracom
PRO
1
340
いいたいことちゃんという
tkengo
0
260
競技としてのKaggle、役に立つKaggle
yu4u
7
2.5k
Featured
See All Featured
The World Runs on Bad Software
bkeepers
PRO
61
6.7k
Typedesign – Prime Four
hannesfritz
36
2.1k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
41
4.4k
Web Components: a chance to create the future
zenorocha
306
41k
Statistics for Hackers
jakevdp
790
220k
10 Git Anti Patterns You Should be Aware of
lemiorhan
649
58k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
352
28k
Side Projects
sachag
451
41k
Scaling GitHub
holman
457
140k
Designing for humans not robots
tammielis
247
25k
Building Applications with DynamoDB
mza
88
5.6k
Happy Clients
brianwarren
92
6.4k
Transcript
HTTP/2.0 [SPeeDY] Andreas Bjärlestam (@bjarlestam)! 2013-03-15!
Something strange happened last year
You know HTTP?
It has been replaced!* *at several of the biggest
sites on the web
And no-‐one has noJced
Why the hell would you want to replace HTTP?
HTTP is fantasJc it has totally changed the world
but…
HTTP is over 20 years old HTTP 1.1 is
12 years old
Webpages in 1999
None
Webpages in 2013
None
Mobile internet usage source: svenskarna och internet 2012
hRps://www.iis.se/docs/SOI2012.pdf
This is how more and more of us consume
the web…
OTen it feels a lot like…
People no longer have paJence to wait for slow
pages
$peed Performance == $$
Being slow has a strong negaJve impact on business
The cost of being slow increases over Jme and persists
Myth: If your site loads in under 4 seconds
you are ok Actually: The negaJve impact of being slow increases linearly!
Bounce rate increases linearly with page load Jme
Search engines rank faster sites higher
Bandwidth doesn’t maRer much anymore Latency does
Bandwidth Page Load Time 1Mbps 3Mbps
9Mbps Latency Page Load Time 240ms 120ms 20ms
Web pages March 2013 • www.facebook.com -‐ ca 170
hRp requests • www.bostonglobe.com -‐ ca 150 hRp requests • www.svtplay.se -‐ ca 50 hRp requests • www.aTonbladet.se -‐ ca 450 hRp requests source: hRp://hRparchive.org/
What does it look like over the network fetching
150 resources?
None
Can you spot the problem?
Its all synchronous
How come an advanced page like facebook.com loads in
under 4 seconds when its all synchronous?
Hacky opJmizaJons CSS sprites base64 images in data-‐urls
CSS concatenaJon JavaScript concatenaJon
HTTP/TCP HTTP/TCP HTTP/TCP HTTP/TCP HTTP/TCP
HTTP/TCP 6 x HTTP connecJons
Domain sharding • www.bostonglobe.com -‐ 25 domains •
www.svtplay.se -‐ 9 domains • www.aTonbladet.se -‐ 42 domains source: hRp://www.webpagetest.org
What is the problem with this? Why not even
more connecJons?
We kind of abuse TCP when we open more
connecJons
2 connecJons per host recommended by HTTP 1.1 spec
6 connecJons in most browsers
and…
New TCP connecJons are slow
3 way handshake
On my macbook Ping 20ms ≈ 30ms to set
up a connecJon On my mobile (3G) Ping 300ms ≈ 450ms to set up a connecJon
HTTP/TCP HTTP/TCP HTTP/TCP HTTP/TCP HTTP/TCP
TCP Slow start HTTP/TCP
Window size 1 2 3 4 5 6 7
8 roundtrips TCP Slow start Packet loss
So… we need to uJlize our TCP connecJons beRer
Enter
Don’t we break the web if we replace HTTP?
Nope
The semanJcs of HTTP is kept
HTTP -‐> SPDY GET PUT POST
… HEADERS Use of URLs Use of TCP GET PUT POST … HEADERS Use of URLs Use of TCP
You can switch to SPDY with no changes to
your web applicaJon
Example…
Designed with speed as primary goal
1 TCP connecJon HTTP/TCP
HTTP/TCP But it will be on fire!
SPDY is mulJplexed
This is a typical HTTP session GET GET
GET 200 OK 200 OK 200 OK
MulJplexing GET 1 GET 2 GET 3
200 OK 2 200 OK 3 200 OK 1
Stream prioriJes
SPDY is binary
HTTP -‐> SPDY
Will be difficult to just fire up telnet and
hack away
Every decent site will be encrypted and gzipped
anyways
curl and wireshark will sJll be your friend
TLS/SSL is mandatory ✗
Simplest way to avoid problems with intermediaries
Headers are compressed
Server Push
Server Push
So is it worth it?
Many studies with slightly different results Most of
them indicate a significant speedup (10% – 60%) hRps://code.google.com/p/mod-‐spdy
SPDY could make your life easier No more hacky
opJmizaJons like CSS sprites, file concatenaJons, domain sharding etc
We need to unlearn some habits unshard
ImplementaJons • Apache mod_spdy • Nginx •
node_spdy • NeRy • JeRy • HAProxy • more…
Browsers • Chrome 6+ • Firefox 13+
• Opera 12.10+ • Amazon silk > 50% of browsers support SPDY
Google • Support SPDY on all their services (gmail
etc) • Most of their SSL traffic is over SPDY
Others • Akamai (Contendo) • Strangeloop •
F5 BIG-‐IP • TwiRer • Facebook • Wordpress • Amazon (kindle fire silkbrowser)
Amazon silk Silk Browser SPDY Gateway
The Internet SPDY HTTP Google has introduced a similar thing in chrome for android (beta version)
The spec • DraT spec, version 4 •
IETF has started to work on HTTP/2.0 • SPDY has been agreed to be the starJng point for HTTP/2.0
Roundup • Faster page loads than HTTP •
Backwards compaJble with HTTP • BeRer uJlizaJon of TCP • Secured by default • Binary + compressed
ARribuJons • hRp://en.wikipedia.org/wiki/ File:US_RoboJcs_56K_Modem_Front.JPG • hRps://www.iis.se/docs/SOI2012.pdf •
hRp://www.flickr.com/photos/howi/6366423373/ • hRp://www.flickr.com/photos/wwarby/5110037138/ • hRp://www.flickr.com/photos/alicetragedy/ 4977295298/ • hRp://www.flickr.com/photos/koltregaskes/ 624914973/in/photostream/
Backup slides
HTTP Pipelining • Not as effecJve as mulJplexing
• Hard to implement in browser • Opera is the only desktop browser that has a full implementaJon enabled by default • Android, IOS5 and Opera mobile browsers do some amount of pipelining • Not used by most proxies
Pipelining GET 1 GET 2 GET 3
200 OK 1 200 OK 2 200 OK 3 GET 1 GET 2 GET 3 200 OK 2 200 OK 3 200 OK 1 MulJplexing GET GET GET 200 OK 200 OK 200 OK Synchronous