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
28
Agile performance testing
bjarlestam
0
110
SPDY or maybe HTTP2.0
bjarlestam
4
59
jquery mobile
bjarlestam
0
68
Devise - taking care of your users
bjarlestam
0
69
REST with JAX-RS
bjarlestam
1
88
REST
bjarlestam
2
160
Other Decks in Technology
See All in Technology
Mini Tokyo 3D × PLATEAU - 公共交通デジタルツインにリアルな風景を
nagix
1
230
エンジニアが一生困らない ドキュメント作成の基本
naohiro_nakata
2
140
株式会社ログラス − エンジニア向け会社説明資料 / Loglass Comapany Deck for Engineer
loglass2019
3
28k
AWS パートナー企業でテクニカルサポートに従事して 3年経ったので思うところをまとめてみた
kazzpapa3
1
220
スクラムチームを立ち上げる〜チーム開発で得られたもの・得られなかったもの〜
ohnoeight
2
290
サイバーセキュリティと認知バイアス:対策の隙を埋める心理学的アプローチ
shumei_ito
0
180
障害対応指揮の意思決定と情報共有における価値観 / Waroom Meetup #2
arthur1
3
270
RAGのためのビジネス文書解析技術
eida
3
660
株式会社島津製作所_研究開発(集団協業と知的生産)の現場を支える、OSS知識基盤システムの導入
akahane92
1
180
Intuneお役立ちツールのご紹介
sukank
3
750
Railsで4GBのデカ動画ファイルのアップロードと配信、どう実現する?
asflash8
1
210
Datadog RUM を用いた UX 指標の監視・顧客対応への活用
imamura_ko_0314
0
110
Featured
See All Featured
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
Being A Developer After 40
akosma
86
590k
How STYLIGHT went responsive
nonsquared
95
5.2k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
27
4.2k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9k
The Cost Of JavaScript in 2023
addyosmani
45
6.7k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Bash Introduction
62gerente
608
210k
Making Projects Easy
brettharned
115
5.9k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
Code Reviewing Like a Champion
maltzj
520
39k
Six Lessons from altMBA
skipperchong
26
3.5k
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