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.2k
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
31
Agile performance testing
bjarlestam
0
110
SPDY or maybe HTTP2.0
bjarlestam
4
62
jquery mobile
bjarlestam
0
70
Devise - taking care of your users
bjarlestam
0
71
REST with JAX-RS
bjarlestam
1
89
REST
bjarlestam
2
170
Other Decks in Technology
See All in Technology
サラリーマンの小遣いで作るtoCサービス - Cloudflare Workersでスケールする開発戦略
shinaps
2
450
人工衛星のファームウェアをRustで書く理由
koba789
15
7.9k
複数サービスを支えるマルチテナント型Batch MLプラットフォーム
lycorptech_jp
PRO
1
380
MCPで変わる Amebaデザインシステム「Spindle」の開発
spindle
PRO
3
3.2k
BPaaSにおける人と協働する前提のAIエージェント-AWS登壇資料
kentarofujii
0
140
共有と分離 - Compose Multiplatform "本番導入" の設計指針
error96num
2
570
「どこから読む?」コードとカルチャーに最速で馴染むための実践ガイド
zozotech
PRO
0
450
Webブラウザ向け動画配信プレイヤーの 大規模リプレイスから得た知見と学び
yud0uhu
0
230
2025年夏 コーディングエージェントを統べる者
nwiizo
0
170
EncryptedSharedPreferences が deprecated になっちゃった!どうしよう! / Oh no! EncryptedSharedPreferences has been deprecated! What should I do?
yanzm
0
380
Language Update: Java
skrb
2
300
react-callを使ってダイヤログをいろんなとこで再利用しよう!
shinaps
1
240
Featured
See All Featured
The Cult of Friendly URLs
andyhume
79
6.6k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
18
1.1k
Raft: Consensus for Rubyists
vanstee
140
7.1k
Fireside Chat
paigeccino
39
3.6k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
36
2.5k
The Art of Programming - Codeland 2020
erikaheidi
56
13k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
1.9k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
126
53k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
252
21k
Building a Scalable Design System with Sketch
lauravandoore
462
33k
Automating Front-end Workflow
addyosmani
1370
200k
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