SlideShare a Scribd company logo
1 of 35
What is HTTP/2?
Okis Chuang
2017/06/04
Intro to HTTP/2
Why HTTP/2
HTTP/1.x drawbacks nowadays
Workarounds for speeding up HTTP/1.1
Goal of HTTP/2
Features of HTTP/2
Demo
Do you know…
Atom has already
adopted HTTP/2
Intro to HTTP/2
Why HTTP/2
HTTP/1.x drawbacks nowadays
Workarounds for speeding up HTTP/1.1
Goal of HTTP/2
Features of HTTP/2
Demo
The IETF HTTP Working Group
HTTP/2 is a replacement for how HTTP is
expressed “on the wire.” It is not a ground-up
rewrite of the protocol
HTTP/1.x Drawbacks
Occupy a TCP connection per request
TCP 3-way handshake
Slow-start of TCP flow control
HTTP Pipelining vs. Head-Of-Line Blocking
(HOL)
Headers are sent with
every request…
. Accept-Ranges:bytes
. Access-Control-Allow-Origin:*
. Age:147613
. Cache-Control:max-age=31536000, public
. Content-Encoding:gzip
. Content-Length:23993
. Content-Type:text/css
. Date:Sat, 03 Jun 2017 07:13:47 GMT
. Expires:Fri, 01 Jun 2018 14:13:33 GMT
. Last-Modified:Sat, 01 Jan 2000 00:00:00 GMT
. Server:GitHub.com
. Timing-Allow-Origin:*
. Vary:Accept-Encoding
. Via:1.1 varnish
. X-Cache:HIT
. X-Cache-Hits:39503
. X-Fastly-Request-ID:4e6f64d3b645f29d9f71564cafa495c30445eca2
. X-GitHub-Request-Id:F9FC:22433:1761B1:1D1A91:5930210D
. X-Served-By:cache-itm7427-ITM
Spriting/Inlining
Image Sprite
save loading time by
merging many smaller
pictures into a bigger one
Resource Inlining
Embed data resource
inside css or html
(DataURI)
Concatenation
A.K.A Bundle
Combining multiple javascript files into a bigger one
instead of making multiple requests separately
Inconvenient to developer
Redundant download due to a small change
Domain Sharding
Splitting resources across multiple domains to
improve page load time
Avg 40 TCP connections for a page according
to http://httparchive.org/
HTTP Pipelining
Pipeline multiple HTTP requests into a TCP connection to server
without waiting each response
Default disabled by browsers like Chrome and Firefox
Intro to HTTP/2
Why HTTP/2
HTTP/1.x drawbacks nowadays
Workarounds for speeding up HTTP/1.1
Goal of HTTP/2
Features of HTTP/2
Demo
HTTP/2
IETF and HTTPbis workgroup
“bis” is a suffix of name used to describe
upgrade of protocol
From SPDY/3 draft -> HTTP/2 draft-00
Boundaries for HTTP/2
Maintain HTTP/1.x paradigm
http:// and https:// URLs cannot be changed
Be able to proxy HTTP/1 request to HTTP/2
Then proxies must be able to map HTTP/2 features to
HTTP/1.x clients 1-1 mapping
Remove or reduce optional parts or protocol
No more minor version
HTTP/2 for Existing URI
schemes
HTTP/1.1 has defined a way to do upgrade - header
One more Round-Trip (SPDY team wouldn’t accept the penalty)
SPDY achieve this by only implementing SPDY over TLS (no
extra protocol)
NPN (Next Protocol Negotiation)
Server list out all supported protocols for client to choose
HTTP/2 vs. TLS
SPDY depends on TLS and HTTP/2 bases on SPDY
BUT TLS is optional in HTTP/2
Chrome and Firefox implement it based on TLS (leaders say so)
long-running debate about whether dictate cipher suites for using TLS
NPN -> ALPN (Application Layer Protocol Negotiation)
Main difference: who decide protocol negotiation?
ALPN: client sends out a prioritized list to server and server decide which one to be
used
NPN: server sends out a list for client to choose
Intro to HTTP/2
Why HTTP/2
HTTP/1.x drawbacks nowadays
Workarounds for speeding up HTTP/1.1
History from SPDY to HTTP/2
Goal of HTTP/2
Features of HTTP/2
Demo
One persistent connection per origin
HTTP/2 is a binary protocol
Binary framing layer
EASY to PARSE
Frame, Message, Stream
Multiplexed
The ability to break down HTTP message into
independent frames, interleave them, and
reassemble them
https://http2.akamai.com/demo
see Chrome Dev Tool
Multiplexed
Stream Prioritization
HTTP/1.x v.s HTTP/2
Header Compression
Using HPACK compression format to reduce overhead
Static and Dynamic table
Allows the transmitted headers to be encoded via Huffman code
Literal values are (optionally) encoded with a static Huffman code
previously seen headers - transferring indexed value
https://http2.github.io/http2-spec/compression.html
Header Compression
Server push
https://http2.golang.org/serverpush
chrome://net-internals/#events&q=type:HTTP2_SESSION%20is:active
node-http2 implementation
Flow Control
TCP flow control is not granular enough - doesn’t provide
app-level to regulate individual stream
It is directional
It is credit-based
It cannot be disabled
It is hop-by-hop, not end-to-end
CURL vs. HTTP/2
Nghttp2
Similar use to HTTP/1.x
Negotiation
Using upgrade header to support HTTP2
Using TLS library - beware of OpenSSL version
—http2 option of CLI
curl_easy_setopt - SURLOPT_HTTP_VERSION
CURL_HTTP_VERSION_2
Multiplexing
HTTP/1.x v.s HTTP/2
https://http2.golang.org/gophertiles
https://http2.golang.org/
References
https://http2.github.io
https://bagder.gitbooks.io/http2-explained
bit.ly/http2-opt
https://http2.github.io/http2-
spec/compression.html

More Related Content

What's hot

Unit III IPV6 UDP
Unit III IPV6 UDPUnit III IPV6 UDP
Unit III IPV6 UDPsangusajjan
 
RTSP Protocol - Explanation to develop API of RTSP Protocol
RTSP Protocol - Explanation to develop API of RTSP ProtocolRTSP Protocol - Explanation to develop API of RTSP Protocol
RTSP Protocol - Explanation to develop API of RTSP ProtocolFranZEast
 
TCP/IP 3-way Handshake
TCP/IP 3-way Handshake TCP/IP 3-way Handshake
TCP/IP 3-way Handshake Alok Tripathi
 
RTSP Analysis Wireshark
RTSP Analysis WiresharkRTSP Analysis Wireshark
RTSP Analysis WiresharkYoss Cohen
 
Network and TCP performance relationship workshop
Network and TCP performance relationship workshopNetwork and TCP performance relationship workshop
Network and TCP performance relationship workshopKae Hsu
 
file transfer and access utilities
file transfer and access utilitiesfile transfer and access utilities
file transfer and access utilitiestumetr1
 
What is the difference between udp and tcp internet protocols
What is the difference between udp and tcp internet protocols What is the difference between udp and tcp internet protocols
What is the difference between udp and tcp internet protocols krupalipandya29
 
Tcp vs udp difference and comparison diffen
Tcp vs udp   difference and comparison   diffenTcp vs udp   difference and comparison   diffen
Tcp vs udp difference and comparison diffenHarikiran Raju
 

What's hot (20)

Ch21
Ch21Ch21
Ch21
 
Unit III IPV6 UDP
Unit III IPV6 UDPUnit III IPV6 UDP
Unit III IPV6 UDP
 
Ftp.75 to 76
Ftp.75 to 76Ftp.75 to 76
Ftp.75 to 76
 
RTSP Protocol - Explanation to develop API of RTSP Protocol
RTSP Protocol - Explanation to develop API of RTSP ProtocolRTSP Protocol - Explanation to develop API of RTSP Protocol
RTSP Protocol - Explanation to develop API of RTSP Protocol
 
Ftp
FtpFtp
Ftp
 
TCP/IP 3-way Handshake
TCP/IP 3-way Handshake TCP/IP 3-way Handshake
TCP/IP 3-way Handshake
 
Meeting 6 : ftp
Meeting 6 : ftpMeeting 6 : ftp
Meeting 6 : ftp
 
RTSP Analysis Wireshark
RTSP Analysis WiresharkRTSP Analysis Wireshark
RTSP Analysis Wireshark
 
Ftp tftp
Ftp tftpFtp tftp
Ftp tftp
 
Network and TCP performance relationship workshop
Network and TCP performance relationship workshopNetwork and TCP performance relationship workshop
Network and TCP performance relationship workshop
 
FTP
FTPFTP
FTP
 
file transfer and access utilities
file transfer and access utilitiesfile transfer and access utilities
file transfer and access utilities
 
What is the difference between udp and tcp internet protocols
What is the difference between udp and tcp internet protocols What is the difference between udp and tcp internet protocols
What is the difference between udp and tcp internet protocols
 
12 ethernet-wifi
12 ethernet-wifi12 ethernet-wifi
12 ethernet-wifi
 
Ports
PortsPorts
Ports
 
Udp
UdpUdp
Udp
 
Lec 8(FTP Protocol)
Lec 8(FTP Protocol)Lec 8(FTP Protocol)
Lec 8(FTP Protocol)
 
Ftp server
Ftp serverFtp server
Ftp server
 
TCP/IP and UDP protocols
TCP/IP and UDP protocolsTCP/IP and UDP protocols
TCP/IP and UDP protocols
 
Tcp vs udp difference and comparison diffen
Tcp vs udp   difference and comparison   diffenTcp vs udp   difference and comparison   diffen
Tcp vs udp difference and comparison diffen
 

Similar to Intro to HTTP/2 - Why it's Faster and the Future of the Web

HTTP/2 and QUICK protocols. Optimizing the Web stack for HTTP/2 era
HTTP/2 and QUICK protocols. Optimizing the Web stack for HTTP/2 eraHTTP/2 and QUICK protocols. Optimizing the Web stack for HTTP/2 era
HTTP/2 and QUICK protocols. Optimizing the Web stack for HTTP/2 erapeychevi
 
Introducing HTTP/2
Introducing HTTP/2Introducing HTTP/2
Introducing HTTP/2Ido Flatow
 
HTTP/2 Introduction
HTTP/2 IntroductionHTTP/2 Introduction
HTTP/2 IntroductionWalter Liu
 
HTTP/2 for Developers
HTTP/2 for DevelopersHTTP/2 for Developers
HTTP/2 for DevelopersSvetlin Nakov
 
HTML5, HTTP2, and You 1.1
HTML5, HTTP2, and You 1.1HTML5, HTTP2, and You 1.1
HTML5, HTTP2, and You 1.1Daniel Austin
 
Introduction to HTTP/2
Introduction to HTTP/2Introduction to HTTP/2
Introduction to HTTP/2Ido Flatow
 
Dynamic Adaptive Streaming over HTTP/2.0
Dynamic Adaptive Streaming over HTTP/2.0Dynamic Adaptive Streaming over HTTP/2.0
Dynamic Adaptive Streaming over HTTP/2.0Christopher Mueller
 
HTTP/2 - A brief introduction
HTTP/2 - A brief introductionHTTP/2 - A brief introduction
HTTP/2 - A brief introductionGibDevs
 
Next generation web protocols
Next generation web protocolsNext generation web protocols
Next generation web protocolsDaniel Austin
 
Evolution of HTTP - Miran Al Mehrab
Evolution of HTTP - Miran Al MehrabEvolution of HTTP - Miran Al Mehrab
Evolution of HTTP - Miran Al MehrabCefalo
 
application layer protocol for iot.pptx
application layer protocol for iot.pptxapplication layer protocol for iot.pptx
application layer protocol for iot.pptxaravind Guru
 
Introduction to HTTP/2
Introduction to HTTP/2Introduction to HTTP/2
Introduction to HTTP/2Ido Flatow
 
A new Internet? Intro to HTTP/2, QUIC, DoH and DNS over QUIC
A new Internet? Intro to HTTP/2, QUIC, DoH and DNS over QUICA new Internet? Intro to HTTP/2, QUIC, DoH and DNS over QUIC
A new Internet? Intro to HTTP/2, QUIC, DoH and DNS over QUICAPNIC
 
A New Internet? Introduction to HTTP/2, QUIC and DOH
A New Internet? Introduction to HTTP/2, QUIC and DOHA New Internet? Introduction to HTTP/2, QUIC and DOH
A New Internet? Introduction to HTTP/2, QUIC and DOHAPNIC
 
Revisiting HTTP/2
Revisiting HTTP/2Revisiting HTTP/2
Revisiting HTTP/2Fastly
 

Similar to Intro to HTTP/2 - Why it's Faster and the Future of the Web (20)

HTTP/2 and QUICK protocols. Optimizing the Web stack for HTTP/2 era
HTTP/2 and QUICK protocols. Optimizing the Web stack for HTTP/2 eraHTTP/2 and QUICK protocols. Optimizing the Web stack for HTTP/2 era
HTTP/2 and QUICK protocols. Optimizing the Web stack for HTTP/2 era
 
Introducing HTTP/2
Introducing HTTP/2Introducing HTTP/2
Introducing HTTP/2
 
HTTP/2 Introduction
HTTP/2 IntroductionHTTP/2 Introduction
HTTP/2 Introduction
 
HTTP/2 for Developers
HTTP/2 for DevelopersHTTP/2 for Developers
HTTP/2 for Developers
 
HTML5, HTTP2, and You 1.1
HTML5, HTTP2, and You 1.1HTML5, HTTP2, and You 1.1
HTML5, HTTP2, and You 1.1
 
Introduction to HTTP/2
Introduction to HTTP/2Introduction to HTTP/2
Introduction to HTTP/2
 
Dynamic Adaptive Streaming over HTTP/2.0
Dynamic Adaptive Streaming over HTTP/2.0Dynamic Adaptive Streaming over HTTP/2.0
Dynamic Adaptive Streaming over HTTP/2.0
 
Http/2
Http/2Http/2
Http/2
 
HTTP/2 - A brief introduction
HTTP/2 - A brief introductionHTTP/2 - A brief introduction
HTTP/2 - A brief introduction
 
Http2
Http2Http2
Http2
 
Next generation web protocols
Next generation web protocolsNext generation web protocols
Next generation web protocols
 
Evolution of HTTP - Miran Al Mehrab
Evolution of HTTP - Miran Al MehrabEvolution of HTTP - Miran Al Mehrab
Evolution of HTTP - Miran Al Mehrab
 
application layer protocol for iot.pptx
application layer protocol for iot.pptxapplication layer protocol for iot.pptx
application layer protocol for iot.pptx
 
Introduction to HTTP/2
Introduction to HTTP/2Introduction to HTTP/2
Introduction to HTTP/2
 
A new Internet? Intro to HTTP/2, QUIC, DoH and DNS over QUIC
A new Internet? Intro to HTTP/2, QUIC, DoH and DNS over QUICA new Internet? Intro to HTTP/2, QUIC, DoH and DNS over QUIC
A new Internet? Intro to HTTP/2, QUIC, DoH and DNS over QUIC
 
A New Internet? Introduction to HTTP/2, QUIC and DOH
A New Internet? Introduction to HTTP/2, QUIC and DOHA New Internet? Introduction to HTTP/2, QUIC and DOH
A New Internet? Introduction to HTTP/2, QUIC and DOH
 
Application Layer
Application Layer Application Layer
Application Layer
 
Http2
Http2Http2
Http2
 
Revisiting HTTP/2
Revisiting HTTP/2Revisiting HTTP/2
Revisiting HTTP/2
 
Web protocol.pptx
Web protocol.pptxWeb protocol.pptx
Web protocol.pptx
 

More from Okis Chuang

Make Your Own IoT Device by ZigBee
Make Your Own IoT Device by ZigBeeMake Your Own IoT Device by ZigBee
Make Your Own IoT Device by ZigBeeOkis Chuang
 
Connected vehicle in_serverless_architecture
Connected vehicle in_serverless_architectureConnected vehicle in_serverless_architecture
Connected vehicle in_serverless_architectureOkis Chuang
 
Let's Talk About Serverless - Focusing on AWS Lambda
Let's Talk About Serverless - Focusing on AWS LambdaLet's Talk About Serverless - Focusing on AWS Lambda
Let's Talk About Serverless - Focusing on AWS LambdaOkis Chuang
 
Neural Network Basics
Neural Network BasicsNeural Network Basics
Neural Network BasicsOkis Chuang
 
Microservice - Data Management
Microservice - Data ManagementMicroservice - Data Management
Microservice - Data ManagementOkis Chuang
 
Oh K8s Is Swag - Kubernetes Basics
Oh K8s Is Swag - Kubernetes BasicsOh K8s Is Swag - Kubernetes Basics
Oh K8s Is Swag - Kubernetes BasicsOkis Chuang
 
Experiences sharing about Lambda, Kinesis, and Postgresql
Experiences sharing about Lambda, Kinesis, and PostgresqlExperiences sharing about Lambda, Kinesis, and Postgresql
Experiences sharing about Lambda, Kinesis, and PostgresqlOkis Chuang
 

More from Okis Chuang (7)

Make Your Own IoT Device by ZigBee
Make Your Own IoT Device by ZigBeeMake Your Own IoT Device by ZigBee
Make Your Own IoT Device by ZigBee
 
Connected vehicle in_serverless_architecture
Connected vehicle in_serverless_architectureConnected vehicle in_serverless_architecture
Connected vehicle in_serverless_architecture
 
Let's Talk About Serverless - Focusing on AWS Lambda
Let's Talk About Serverless - Focusing on AWS LambdaLet's Talk About Serverless - Focusing on AWS Lambda
Let's Talk About Serverless - Focusing on AWS Lambda
 
Neural Network Basics
Neural Network BasicsNeural Network Basics
Neural Network Basics
 
Microservice - Data Management
Microservice - Data ManagementMicroservice - Data Management
Microservice - Data Management
 
Oh K8s Is Swag - Kubernetes Basics
Oh K8s Is Swag - Kubernetes BasicsOh K8s Is Swag - Kubernetes Basics
Oh K8s Is Swag - Kubernetes Basics
 
Experiences sharing about Lambda, Kinesis, and Postgresql
Experiences sharing about Lambda, Kinesis, and PostgresqlExperiences sharing about Lambda, Kinesis, and Postgresql
Experiences sharing about Lambda, Kinesis, and Postgresql
 

Recently uploaded

SCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is prediSCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is predieusebiomeyer
 
Unidad 4 – Redes de ordenadores (en inglés).pptx
Unidad 4 – Redes de ordenadores (en inglés).pptxUnidad 4 – Redes de ordenadores (en inglés).pptx
Unidad 4 – Redes de ordenadores (en inglés).pptxmibuzondetrabajo
 
Cybersecurity Threats and Cybersecurity Best Practices
Cybersecurity Threats and Cybersecurity Best PracticesCybersecurity Threats and Cybersecurity Best Practices
Cybersecurity Threats and Cybersecurity Best PracticesLumiverse Solutions Pvt Ltd
 
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书rnrncn29
 
TRENDS Enabling and inhibiting dimensions.pptx
TRENDS Enabling and inhibiting dimensions.pptxTRENDS Enabling and inhibiting dimensions.pptx
TRENDS Enabling and inhibiting dimensions.pptxAndrieCagasanAkio
 
IP addressing and IPv6, presented by Paul Wilson at IETF 119
IP addressing and IPv6, presented by Paul Wilson at IETF 119IP addressing and IPv6, presented by Paul Wilson at IETF 119
IP addressing and IPv6, presented by Paul Wilson at IETF 119APNIC
 
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书rnrncn29
 
Company Snapshot Theme for Business by Slidesgo.pptx
Company Snapshot Theme for Business by Slidesgo.pptxCompany Snapshot Theme for Business by Slidesgo.pptx
Company Snapshot Theme for Business by Slidesgo.pptxMario
 
ETHICAL HACKING dddddddddddddddfnandni.pptx
ETHICAL HACKING dddddddddddddddfnandni.pptxETHICAL HACKING dddddddddddddddfnandni.pptx
ETHICAL HACKING dddddddddddddddfnandni.pptxNIMMANAGANTI RAMAKRISHNA
 

Recently uploaded (9)

SCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is prediSCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is predi
 
Unidad 4 – Redes de ordenadores (en inglés).pptx
Unidad 4 – Redes de ordenadores (en inglés).pptxUnidad 4 – Redes de ordenadores (en inglés).pptx
Unidad 4 – Redes de ordenadores (en inglés).pptx
 
Cybersecurity Threats and Cybersecurity Best Practices
Cybersecurity Threats and Cybersecurity Best PracticesCybersecurity Threats and Cybersecurity Best Practices
Cybersecurity Threats and Cybersecurity Best Practices
 
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
 
TRENDS Enabling and inhibiting dimensions.pptx
TRENDS Enabling and inhibiting dimensions.pptxTRENDS Enabling and inhibiting dimensions.pptx
TRENDS Enabling and inhibiting dimensions.pptx
 
IP addressing and IPv6, presented by Paul Wilson at IETF 119
IP addressing and IPv6, presented by Paul Wilson at IETF 119IP addressing and IPv6, presented by Paul Wilson at IETF 119
IP addressing and IPv6, presented by Paul Wilson at IETF 119
 
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
 
Company Snapshot Theme for Business by Slidesgo.pptx
Company Snapshot Theme for Business by Slidesgo.pptxCompany Snapshot Theme for Business by Slidesgo.pptx
Company Snapshot Theme for Business by Slidesgo.pptx
 
ETHICAL HACKING dddddddddddddddfnandni.pptx
ETHICAL HACKING dddddddddddddddfnandni.pptxETHICAL HACKING dddddddddddddddfnandni.pptx
ETHICAL HACKING dddddddddddddddfnandni.pptx
 

Intro to HTTP/2 - Why it's Faster and the Future of the Web

Editor's Notes

  1. HTTP現狀 几乎所有互联网上的内容都采用了HTTP 1.1作为通信协议。人们在该协议上投入了大量精力,所以基于它的基础架构也得以日臻完善。而得益于此,在现有的HTTP协议之上构建新的方案会比从底层建立新的协议要容易得多。
  2. Spriting是一種將很多較小的圖片合併成一張大圖,再用JavaScript或者CSS將小圖重新“切割”出來的技術。在HTTP 1.1裡,下載一張大圖比下載100張小圖快得多。壞處是如果某些頁面只需要幾張小圖,還是必須從cache裡把整張大圖撈出來 Inlining是另外一種防止發送很多小圖請求的技巧,它將圖片的原始數據嵌入在CSS文件裡面的URL裡
  3. 最初的HTTP 1.1規範提到一個客戶端最多只能對同一主機建立兩個TCP連接。因此,為了不和規範衝突,一些聰明的網站使用了新的主機名,這樣的話,用戶就能和網站建立更多的連接,從而降低載入時間。後來,兩個接的限制被取消了,現在的客戶端可以輕鬆地和每個主機建立6-8個連接。但很多網站還是會使用此技術來提高connection數量 YouTube splits images and script resources across two domains: i.ytimg.com and s.ytimg.com. i.ytimg.com contains icons, logos, thumbnails, avatars, and other visual elements while s.ytimg.com contains JavaScript, CSS, favicons, sprite sheets, and objects related to website optimization and analytics.
  4. 工作組名字中的“bis”來自拉丁語中表示“二”的副詞,Bis通常被IETF用作名字的後綴來以表示標準的升級或者一些二次工作,比如這裡是針對HTTP1.1。
  5. 還是必須維持既有的HTTP典範 太多現有的網站使用這樣的URL,不能指望全部都改變 HTTP1可能還會存在很久,必須提供 http/1到http/2的proxy proxy也要能將http2的功能一對一的mapping到http1的client上 SPDY和Google的團隊都非常喜歡這點。通過讓協議裡所有的內容都成為了強制性要求,可以防止人們在實現的時候偷懶,從而規避一些將來可能會發生的問題 服務器和客戶端都必須確定自己是否完整兼容http2或者徹底不兼容。如果將來該協議需要被擴充或者變更,那麼新的協議將會是http3,而不是http 2.x
  6. 如上所述,現有的URI結構正在被HTTP 1.x使用而不能被更換,所以http2也必須沿用該結構。因此不得不找到一種方式將使用的協議升級至http2,比如可以要求server使用http2來替代舊的協議。 in http1.1 有設計一個 header 可以進行upgrade的,可以讓server在client用舊的protocol時,在 response 中告知可以使用新的protocol ,但壞處是多了一次 round-trip 他們只實現了基於TLS的SPDY,所以他們開發了一個TLS的擴展去簡化協議的協商。這個擴展被稱作NPN(Next Protocol Negotiation) server 會通知 client 所有他支持的protocol給client選擇
  7. http2可以在TLS上正常的運作,而SPDY依賴於TLS,所以按理說TLS也應成為http2必需的組件,不過出乎大家意料的是http2將TLS標記成了可選 SPDY繼續用NPN 而HTTP2用ALPN,由於NPN較早被實現,為了兼容後來很多會兼容兩者
  8. 歸功於 multiplex stream in parallel
  9. 仔细想想,如果你是一个曾经跟互联网协议打过交道,那你很可能会本能反对二进制协议,你甚至准备好了一大堆理由来证明基于文本/ascii的协议是多么的有用,正如你曾无数次地通过telnet等应用手工地输入HTTP来发起请求。
  10. frame payload size是根據receiver advertises in the SETTINGS_MAX_FRAME_SIZE setting 冷知識:在 HTTP/1.1 定義了四種解析訊息的方式,在 HTTP/2 只需要一種
  11. • Frame: The smallest unit of communication in HTTP/2, each containing a frame header, which at a minimum identifies the stream to which the frame belongs. • Message: A complete sequence of frames that map to a logical request or response message. • Stream: A bidirectional flow of bytes within an established connection, which may carry one or more messages.
  12. https://http2.akamai.com/demo see Chrome Dev Tool
  13. 可以這麼說,http2把http protocol本來的溝通拆分成一個一個可以交換的binary frame,每個 stream都有屬於自己的 frame,而所有的stream都在同一個TCP connection裡面多工,意思 frame 可以任意混在不同的 stream 裡被傳輸 以圖為例,client 在 stream5傳送 data frame給server,同時server也在 stream1,3傳送交錯的frame給client,一個connection內同時有三個stream在平行傳送
  14. 因為 frame 可以被client/server隨便亂插入任意的 stream 內被 multiplexed 所以prioritization 很重要 以第一個為例,A B stream 資源分配是 A: 12/12+4 B: 4/12+4 按照比例分配
  15. 在HPACK壓縮時會有 static and dynamic 兩種table ,static 為predefined 且比較common的header field list dynamic table一開始則是空的,然後會在decompress後更新table 所以整個request的size會因為沒看過的header被huffman壓縮,然後再用index去static or dynamic table 去查表得到 value
  16. 这个功能通常被称作“缓存推送”。主要的思想是:当一个客户端请求资源X,而服务器知道它很可能也需要资源Z的情况下,服务器可以在客户端发送请求前,主动将资源Z推送给客户端。这个功能帮助客户端将Z放进缓存以备将来之需。 服务器推送需要客户端显式的允许服务器提供该功能。但即使如此,客户端依然能自主选择是否需要中断该推送的流。如果不需要的话,客户端可以通过发送一个RST_STREAM帧来中止。
  17. 對於每個stream來說,雙方都必須告知對方自己還有足夠的空間來處理data,另一端只能依據對方提出的window size來傳送數據 注意!只有 data frame 會受到流量控制
  18. curl会在内部把收到的http2头部转换为HTTP1.x风格的头部再呈现给用户,这样一来,它们就和目前的HTTP非常类似。curl会用相同的方式对发出的HTTP头部做转换,即发给curl的HTTP 1.x风格头部会在被发送到http2服务器之前完成转换