SlideShare a Scribd company logo
IN A HTTP/2 WORLD
DOUGLAS VAZ, EQUAL EXPERTS
DECCAN RUBYCONF 2017
1. CURRENT STATE
2. PROBLEMS WITH HTTP/1.x
3. HTTP/2 (H2) FEATURES
4. RETHINKING CURRENT PRACTICES
5. ADOPTION, AND THE STATE OF RUBY
HTTP - A brief history
1997 - RFC 2068 (HTTP/1.1 first draft)
1999 - RFC 2616 (standard for HTTP/1.1)
2014 - RFC 7230 (6 part spec to revise HTTP/1.1)
1989 - 1996 - HTTP/1.0
1. Current State
However…
1. Current State
SYN
SYN/ACK
ACK
Client Server
Request HTML
Response
Request CSS, JS, img *
assets
TCP
Handshake
1. Current State
1. Current State
Problem 1: HTTP/1.x only allowed sequential request/response
HTTP/1.x wasn’t designed for async requests.
Pipelining allowed async requests but responses need to be consumed in order. Slow
responses would block all later requests and reduce overall performance i.e. head-of-
line blocking
2. Problems with HTTP/1.x
Workaround:
Browsers disabled pipelining and used multiple connections
2. Problems with HTTP/1.x
Since only one requestconnection serviced at a given time, increasing bandwidth
doesn’t reduce latency.
Browsers open multiple connections for parallel requests, but are restricted to a
max number per domain
Problem 2: More bandwidth doesn’t mean lower latency
http://httparchive.org/
2. Problems with HTTP/1.x
Workaround:
Domain sharding and asset concatenation to
increase parallelism and reduce RTT
2. Problems with HTTP/1.x
SYN
SYN/ACK
ACK
Client
Server
Request HTML
Response
Request CSS, JS, img *
assets
TCP
Handshake
Processing
time
Problem 3: Transfers are blocked while the server
processes requests
2. Problems with HTTP/1.x
Workaround:
tely with an intermediate state and serve content when ready via
2. Problems with HTTP/1.x
ession data stored in cookies are transferred as uncompressed headers and can add several kilo
Problem 4: Protocol overhead due to headers
2. Problems with HTTP/1.x
Workaround:
Most servers impose a limit on header size
2. Problems with HTTP/1.x
HTTP/2RFC 7540, May 2015
3. H2 Features
3. H2 Features
H2 Key Features
• Parallel request streams on a single connection
• Binary protocol
• Server push
• Header compression
• Stream prioritisation
3. H2 Features
Binary Framing
Credits: Ilya Grigorik
Frame Multiplexing
3. H2 Features
Parallel requests with HTTP/1.1
- Open multiple connections (ex. 6 in Chrome)
- High request queue time
3. H2 Features
Parallel requests with HTTP/2
“Designed to reduce perceived latency”
- Request multiple files in parallel on same connection
- All requests are served immediately
Based on Go’s HTTP/2 Demo
3. H2 Features
Credits: Ilya Grigorik
HPACK
Header Compression
3. H2 Features
HPACK compression performance
3. H2 Features
Current Practices
Keep doing or stop?
4. Rethinking Practices
Domain Sharding
https://www.keycdn.com/support/domain-sharding/
Don’t do this with HTTP/2
4. Rethinking Practices
Asset Concatenation
http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/webpack.html
Not necessary anymore*
4. Rethinking Practices
HTTP/2
Implementations
How do I use it?
5. Adoption, Implementation, Ruby
Browser Support
5. Adoption, Implementation, Ruby
Server Support
5. Adoption, Implementation, Ruby
Available Tools
5. Adoption, Implementation, Ruby
• Chrome Dev Tools (inspect sessions and streams)
• Wireshark (inspect frames and compressed headers)
• nghttp2 (C library plus helpful binaries)
• curl (needs to be build from source)
What about Ruby?
+
HTTP/2
=
:`(
5. Adoption, Implementation, Ruby
Rack is not HTTP/2 compatible!
• Rack is designed for request/response cycles
• Communication with backend servers is not bi-directional
or message oriented
5. Adoption, Implementation, Ruby
Option 1: igrigorik/http-2
gem install http-2
Limitations:
1. Not Rack compatible, hence can’t be used with Rails
2. Does not negotiate a fallback to HTTP/1.x
Pure Ruby implementation of HTTP/2
5. Adoption, Implementation, Ruby
Option 2: H2 Enabled Proxy + Ruby backend
Limitations:
1. Multiplexing won’t work
2. Server push requires additional configuration
Proxy client requests via H20, nghttpx, Apache or nginx
Enables header compression!
5. Adoption, Implementation, Ruby
Option 3: Server push via a CDN
Hinted push: Use Link headers in the response
Link: </css/styles.css>; rel=preload; as=style
5. Adoption, Implementation, Ruby
Option 4: Server push via an edge proxy
Manual server push by configuring the edge proxy
5. Adoption, Implementation, Ruby
Caveats
1. Server might push files that are already cached
2. Server might push files not present on page
3. Stream prioritisation and cancelling might be affected by OS level TCP buffers
5. Adoption, Implementation, Ruby
Thank you
Douglas Vaz
@Mistcrafter
References
• Risks of pipelining: https://www.chromium.org/developers/design-
documents/network-stack/http-pipelining
• Design and technical goals: https://hpbn.co/http2/#design-and-technical-goals
• Study on bandwidth vs latency:
https://docs.google.com/a/chromium.org/viewer?a=v&pid=sites&srcid=Y2hyb2
1pdW0ub3JnfGRldnxneDoxMzcyOWI1N2I4YzI3NzE2
• Starting point for HTTP/2: https://http2.github.io/
• HTTP/2 for Ruby: https://www.speedshop.co/2016/01/07/what-http2-means-
for-ruby-developers.html

More Related Content

What's hot

O'Reilly Fluent Conference: HTTP/1.1 vs. HTTP/2
O'Reilly Fluent Conference: HTTP/1.1 vs. HTTP/2O'Reilly Fluent Conference: HTTP/1.1 vs. HTTP/2
O'Reilly Fluent Conference: HTTP/1.1 vs. HTTP/2
Load Impact
 
HTTP by Hand: Exploring HTTP/1.0, 1.1 and 2.0
HTTP by Hand: Exploring HTTP/1.0, 1.1 and 2.0HTTP by Hand: Exploring HTTP/1.0, 1.1 and 2.0
HTTP by Hand: Exploring HTTP/1.0, 1.1 and 2.0
Cory Forsyth
 
Http2
Http2Http2
HTTP2 & HPACK #pyfes 2013-11-30
HTTP2 & HPACK #pyfes 2013-11-30HTTP2 & HPACK #pyfes 2013-11-30
HTTP2 & HPACK #pyfes 2013-11-30
Jxck Jxck
 
HTTP/2 Update - FOSDEM 2016
HTTP/2 Update - FOSDEM 2016HTTP/2 Update - FOSDEM 2016
HTTP/2 Update - FOSDEM 2016
Daniel Stenberg
 
Better performances with HTTP/2
Better performances with HTTP/2Better performances with HTTP/2
Better performances with HTTP/2
Thomas Segismont
 
HTTP/2 Changes Everything
HTTP/2 Changes EverythingHTTP/2 Changes Everything
HTTP/2 Changes Everything
Lori MacVittie
 
SPDY and HTTP/2
SPDY and HTTP/2SPDY and HTTP/2
SPDY and HTTP/2
Fabian Frank
 
HTML5, HTTP2, and You 1.1
HTML5, HTTP2, and You 1.1HTML5, HTTP2, and You 1.1
HTML5, HTTP2, and You 1.1
Daniel Austin
 
HTTP/2 : why upgrading the web? - apidays Paris
HTTP/2 : why upgrading the web? - apidays ParisHTTP/2 : why upgrading the web? - apidays Paris
HTTP/2 : why upgrading the web? - apidays Paris
Quentin Adam
 
Http/2 lightning
Http/2   lightningHttp/2   lightning
Http/2 lightning
Adrian Cardenas
 
Communicating on the web
Communicating on the webCommunicating on the web
Communicating on the web
Adrian Cardenas
 
Http2
Http2Http2
Attacking http2 implementations (1)
Attacking http2 implementations (1)Attacking http2 implementations (1)
Attacking http2 implementations (1)
John Villamil
 
Stuart Larsen, attacking http2implementations-rev1
Stuart Larsen, attacking http2implementations-rev1Stuart Larsen, attacking http2implementations-rev1
Stuart Larsen, attacking http2implementations-rev1
PacSecJP
 
HTTP2 is Here!
HTTP2 is Here!HTTP2 is Here!
HTTP2 is Here!
Andy Davies
 
Http smuggling 1 200523064027
Http smuggling 1 200523064027Http smuggling 1 200523064027
Http smuggling 1 200523064027
n|u - The Open Security Community
 
HTTP Request Smuggling
HTTP Request SmugglingHTTP Request Smuggling
HTTP Request Smuggling
Akash Ashokan
 
Tomcat Server
Tomcat ServerTomcat Server
Tomcat Server
Anirban Majumdar
 
Smuggling TCP traffic through HTTP
Smuggling TCP traffic through HTTPSmuggling TCP traffic through HTTP
Smuggling TCP traffic through HTTP
Dávid Halász
 

What's hot (20)

O'Reilly Fluent Conference: HTTP/1.1 vs. HTTP/2
O'Reilly Fluent Conference: HTTP/1.1 vs. HTTP/2O'Reilly Fluent Conference: HTTP/1.1 vs. HTTP/2
O'Reilly Fluent Conference: HTTP/1.1 vs. HTTP/2
 
HTTP by Hand: Exploring HTTP/1.0, 1.1 and 2.0
HTTP by Hand: Exploring HTTP/1.0, 1.1 and 2.0HTTP by Hand: Exploring HTTP/1.0, 1.1 and 2.0
HTTP by Hand: Exploring HTTP/1.0, 1.1 and 2.0
 
Http2
Http2Http2
Http2
 
HTTP2 & HPACK #pyfes 2013-11-30
HTTP2 & HPACK #pyfes 2013-11-30HTTP2 & HPACK #pyfes 2013-11-30
HTTP2 & HPACK #pyfes 2013-11-30
 
HTTP/2 Update - FOSDEM 2016
HTTP/2 Update - FOSDEM 2016HTTP/2 Update - FOSDEM 2016
HTTP/2 Update - FOSDEM 2016
 
Better performances with HTTP/2
Better performances with HTTP/2Better performances with HTTP/2
Better performances with HTTP/2
 
HTTP/2 Changes Everything
HTTP/2 Changes EverythingHTTP/2 Changes Everything
HTTP/2 Changes Everything
 
SPDY and HTTP/2
SPDY and HTTP/2SPDY and HTTP/2
SPDY and HTTP/2
 
HTML5, HTTP2, and You 1.1
HTML5, HTTP2, and You 1.1HTML5, HTTP2, and You 1.1
HTML5, HTTP2, and You 1.1
 
HTTP/2 : why upgrading the web? - apidays Paris
HTTP/2 : why upgrading the web? - apidays ParisHTTP/2 : why upgrading the web? - apidays Paris
HTTP/2 : why upgrading the web? - apidays Paris
 
Http/2 lightning
Http/2   lightningHttp/2   lightning
Http/2 lightning
 
Communicating on the web
Communicating on the webCommunicating on the web
Communicating on the web
 
Http2
Http2Http2
Http2
 
Attacking http2 implementations (1)
Attacking http2 implementations (1)Attacking http2 implementations (1)
Attacking http2 implementations (1)
 
Stuart Larsen, attacking http2implementations-rev1
Stuart Larsen, attacking http2implementations-rev1Stuart Larsen, attacking http2implementations-rev1
Stuart Larsen, attacking http2implementations-rev1
 
HTTP2 is Here!
HTTP2 is Here!HTTP2 is Here!
HTTP2 is Here!
 
Http smuggling 1 200523064027
Http smuggling 1 200523064027Http smuggling 1 200523064027
Http smuggling 1 200523064027
 
HTTP Request Smuggling
HTTP Request SmugglingHTTP Request Smuggling
HTTP Request Smuggling
 
Tomcat Server
Tomcat ServerTomcat Server
Tomcat Server
 
Smuggling TCP traffic through HTTP
Smuggling TCP traffic through HTTPSmuggling TCP traffic through HTTP
Smuggling TCP traffic through HTTP
 

Similar to In a HTTP/2 World - DeccanRubyConf 2017

Java EE 8: What Servlet 4.0 and HTTP/2 mean to you
Java EE 8: What Servlet 4.0 and HTTP/2 mean to youJava EE 8: What Servlet 4.0 and HTTP/2 mean to you
Java EE 8: What Servlet 4.0 and HTTP/2 mean to you
Alex Theedom
 
Http 2
Http 2Http 2
Http2 is here! And why the web needs it
Http2 is here! And why the web needs itHttp2 is here! And why the web needs it
Http2 is here! And why the web needs it
IndicThreads
 
Java EE 8: What Servlet 4.0 and HTTP2 mean to you
Java EE 8: What Servlet 4.0 and HTTP2 mean to youJava EE 8: What Servlet 4.0 and HTTP2 mean to you
Java EE 8: What Servlet 4.0 and HTTP2 mean to you
Alex Theedom
 
JDKIO: Java EE 8 what Servlet 4 and HTTP2 mean to you
JDKIO: Java EE 8 what Servlet 4 and HTTP2 mean to youJDKIO: Java EE 8 what Servlet 4 and HTTP2 mean to you
JDKIO: Java EE 8 what Servlet 4 and HTTP2 mean to you
Alex Theedom
 
Next generation web protocols
Next generation web protocolsNext generation web protocols
Next generation web protocols
Daniel Austin
 
Java EE 8: What Servlet 4 and HTTP2 Mean
Java EE 8: What Servlet 4 and HTTP2 MeanJava EE 8: What Servlet 4 and HTTP2 Mean
Java EE 8: What Servlet 4 and HTTP2 Mean
Alex Theedom
 
What's New in HTTP/2
What's New in HTTP/2What's New in HTTP/2
What's New in HTTP/2
NGINX, Inc.
 
Http2 kotlin
Http2   kotlinHttp2   kotlin
Http2 kotlin
Andrii Bezruchko
 
Http/2
Http/2Http/2
HTTP/2 for Developers
HTTP/2 for DevelopersHTTP/2 for Developers
HTTP/2 for Developers
Svetlin Nakov
 
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
APNIC
 
HTTP/2 turns 3 years old // Web Performance Meetup wao.io 20180612
HTTP/2 turns 3 years old // Web Performance Meetup wao.io 20180612HTTP/2 turns 3 years old // Web Performance Meetup wao.io 20180612
HTTP/2 turns 3 years old // Web Performance Meetup wao.io 20180612
Avenga Germany GmbH
 
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
peychevi
 
HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...
HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...
HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...
Edward Burns
 
Enabling Googley microservices with HTTP/2 and gRPC.
Enabling Googley microservices with HTTP/2 and gRPC.Enabling Googley microservices with HTTP/2 and gRPC.
Enabling Googley microservices with HTTP/2 and gRPC.
Alex Borysov
 
HTTP
HTTPHTTP
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
APNIC
 
Let's use modern protocols everywhere!
Let's use modern protocols everywhere!Let's use modern protocols everywhere!
Let's use modern protocols everywhere!
jcak77
 
computer networking
computer networkingcomputer networking
computer networking
seyvan rahimi
 

Similar to In a HTTP/2 World - DeccanRubyConf 2017 (20)

Java EE 8: What Servlet 4.0 and HTTP/2 mean to you
Java EE 8: What Servlet 4.0 and HTTP/2 mean to youJava EE 8: What Servlet 4.0 and HTTP/2 mean to you
Java EE 8: What Servlet 4.0 and HTTP/2 mean to you
 
Http 2
Http 2Http 2
Http 2
 
Http2 is here! And why the web needs it
Http2 is here! And why the web needs itHttp2 is here! And why the web needs it
Http2 is here! And why the web needs it
 
Java EE 8: What Servlet 4.0 and HTTP2 mean to you
Java EE 8: What Servlet 4.0 and HTTP2 mean to youJava EE 8: What Servlet 4.0 and HTTP2 mean to you
Java EE 8: What Servlet 4.0 and HTTP2 mean to you
 
JDKIO: Java EE 8 what Servlet 4 and HTTP2 mean to you
JDKIO: Java EE 8 what Servlet 4 and HTTP2 mean to youJDKIO: Java EE 8 what Servlet 4 and HTTP2 mean to you
JDKIO: Java EE 8 what Servlet 4 and HTTP2 mean to you
 
Next generation web protocols
Next generation web protocolsNext generation web protocols
Next generation web protocols
 
Java EE 8: What Servlet 4 and HTTP2 Mean
Java EE 8: What Servlet 4 and HTTP2 MeanJava EE 8: What Servlet 4 and HTTP2 Mean
Java EE 8: What Servlet 4 and HTTP2 Mean
 
What's New in HTTP/2
What's New in HTTP/2What's New in HTTP/2
What's New in HTTP/2
 
Http2 kotlin
Http2   kotlinHttp2   kotlin
Http2 kotlin
 
Http/2
Http/2Http/2
Http/2
 
HTTP/2 for Developers
HTTP/2 for DevelopersHTTP/2 for Developers
HTTP/2 for Developers
 
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
 
HTTP/2 turns 3 years old // Web Performance Meetup wao.io 20180612
HTTP/2 turns 3 years old // Web Performance Meetup wao.io 20180612HTTP/2 turns 3 years old // Web Performance Meetup wao.io 20180612
HTTP/2 turns 3 years old // Web Performance Meetup wao.io 20180612
 
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
 
HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...
HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...
HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...
 
Enabling Googley microservices with HTTP/2 and gRPC.
Enabling Googley microservices with HTTP/2 and gRPC.Enabling Googley microservices with HTTP/2 and gRPC.
Enabling Googley microservices with HTTP/2 and gRPC.
 
HTTP
HTTPHTTP
HTTP
 
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
 
Let's use modern protocols everywhere!
Let's use modern protocols everywhere!Let's use modern protocols everywhere!
Let's use modern protocols everywhere!
 
computer networking
computer networkingcomputer networking
computer networking
 

Recently uploaded

20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
Zilliz
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
IndexBug
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
Claudio Di Ciccio
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
Mariano Tinti
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 

Recently uploaded (20)

20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 

In a HTTP/2 World - DeccanRubyConf 2017

Editor's Notes

  1. First used in 1989, along with other protocols such as Gopher. By 1995, HTTP had become the de fecto application layer protocol. This lead to standardisation by the Internet Engineering Task Force and HTTP/1.1 was published in ‘97 In 2014, HTTP/1.1 was further clarified with a 6 part draft (with regard to use of certain headers (Content-*, Referer, Location)
  2. While HTTP continued to remain the same, the internet was not the same playing field. The number and size of assets on a web page increased nearly exponentially. Almost a 10x increase from 2000 to 2016. It was clear that the protocol imposed restrictions that could no longer be dealt with at the application layer.
  3. How HTTP/1.x behaves. Starts with a 3 way TCP handshake to establish a connection. Browser requests an HTML page, parses it, and then requests for images, Javascript files, CSS files and other assets (one at a time over a connection)
  4. Typical HTTP/1.1 request and response format. Method, followed by path followed by protocol, followed by mandatory and optional headers. Response is similar. Starts with a status line, followed by a newline, headers and then data NOTE: TEXT BASED and human readable which makes it easy to construct by hand or debug
  5. HTTP/1.0 needed one connection per asset, HTTP/1.1 introduced keep-alive, but requests were synchronous. Also introduced pipelining which enabled sending multiple requests without waiting for a response, but responses needed to be consumed in order. If the first response is slow, all other later responses will be blocked. Badly implemented by proxies
  6. (The option to enable pipelining has been removed from Chrome, as there are known crashing bugs and known front-of-queue blocking issues. There are also a large number of servers and middleboxes that behave badly and inconsistently when pipelining is enabled. )
  7. Data bandwidth today is much greater than in early-2000s. Yet we couldn't take advantage of this because of the protocol limitations. Both transfer sizes and number of assets per page are growing (ex. CNN has 157 resources) Connection limit: could exhaust server and client limit
  8. Common practices to get around browser limits to make assets download faster, bundling assets together (JS, CSS, images) to avoid multiple round trips
  9. The network connection is blocked when the server is processing a request (browsers can’t request anymore on the connection, servers can’t switch to sending alternate files in the meantime)
  10. Return a static view, which can then fetch the remaining content when it’s ready (how most SPAs work)
  11. Since, HTTP is stateless, every request needs to convey the context. This is useful but can also be a huge overhead due to duplication of data on the wire However, the fact that all HTTP headers are transferred in plain text (without any compression), can lead to high overhead costs for each and every request, which can be a serious bottleneck for some applications and devices with limited resources. 
  12. RFC 2616 (HTTP 1.1) does not define any limit on the size of the HTTP headers. in practice, many servers and proxies will try to enforce either an 8 KB or a 16 KB limit.
  13. In May 2015, HTTP/2 became a standard. A lot of vendors who had already supported SPDY due to Google’s influence quickly migrated to this spec
  14. Metaphor for HTTP/2’s design. Instead of placing an order one item at a time, you simply request for the entire meal upfront. You can also specify priorities such as wanting wine before the appetiser.
  15. A single TCP connection can have several logical connections, each transporting it’s own data. This is done by splitting packets into typed, interleaved frames, each having a unique identifier to indicate which stream it belongs to. H2 is a binary protocol, so not human readable and harder to debug. But much more efficient for a machine to process (think IoT with resource constraints) Server push is a feature where the server can send out data without an explicit request. This also indicated that streams are bidirectional in nature Headers are now sent in a frame at the start of a stream and the context is maintained for all frames in that stream. Additionally, the headers are compressed with a new algorithm called HPACK Clients can assign a priority weight to streams to fetch the more important files first (ex. CSS before images and fonts). Server doesn’t have to comply or can decide a default priority for different request types
  16. HTTP connection with 3 active streams. The colours indicate grouping of frames into a stream. Open a connection with HEADERS frame, send data with DATA frame. Streams can also be cancelled using a RST_STREAM header. How much of a difference does this make?
  17. A demonstration first constructed by the Golang team: The logo is tiled, comprising of 256 image tags on a web page. On page load, the browser requests for all 256 images in parallel. However, only one asset can be downloaded per connection and Chrome opens up 6 connections. That’s only 6 x 2 kb (12kbps) of a 2 Mbps connection.
  18. In contrast let’s see how HTTP/2 performs. All 256 tiles served at once. Less that a second on a 2 Mbps connection
  19. Header compression to reduce duplication with every request. HPACK is based on Huffman encoding with both a static and dynamic table. Header-value pairs sorted in descending order of frequency. The most frequently occurring header-value pair was given the smallest bit value. Apart from this static table, a connection can also negotiate a dynamic table which is used for lookups specific to that connection
  20. When I tested this on popular H2 enabled websites, the results were very positive. google.com shows an amazing 87% reduction in header size, which translates to lower bandwidth requirements.
  21. So should we continue with our existing best practices now that HTTP/2 is around
  22. Domain sharding is a practice of distributing assets among a set of domains to increase the number of connections to download in parallel. This is no longer needed cause parallel downloads can now be done with a single connection. Domain sharding is expensive cause of the DNS lookup plus handshake for each connection.
  23. Not necessary as a web optimisation. Easier to maintain cache consistency cause of separation. Keep stable vendor libs + frequently changing business code can be separated so that every small change does not invalidate the cache. Some bundling might be a good idea easy maintainability
  24. Common web servers, application server, CDNs Akamai and Cloudflare
  25. Chrome allows filtering on all active HTTP/2 sessions. Useful for viewing stream data Wireshark, network protocol analyser, has some support like decoding HPACK (but decoding streams is not straightforward) nghttp client to connect to H2 servers with HTTP Upgrade ALPN nghttpx -multi-threaded reverse proxy for HTTP/2, SPDY and HTTP/1.1 (mruby support available) Popular command line tool for fetching data from a server. Most OS distributions aren’t compiled with H2 capabilities (run with -V and look for HTTP2 under features)
  26. Turns out that Ruby has VERY limited support for HTTP/2. One of the reasons is that almost all Ruby web frameworks depend on Rack at the CGI level to talk to the web server
  27. The problem is, Rack is not HTTP/2 compatible. The architecture makes assumptions and hence cannot easily accommodate the new message oriented, bi-directional stream communication. There are still ways to use HTTP/2 with Ruby
  28. (don’t use in production, but good POC)
  29. Preload is a web optimisation technique to indicate assets which need an early fetch. Usually used via the <link> HTML tag. Some servers look for the LINK header in the application’s response and sends a PUSH_PROMISE frame followed by a DATA frame with actual content. Server can reject the push promise with a RST_STREAM frame Note: Server can only hint additional resource belonging to same origin policy.
  30. Similar to the CDN option, this relies on a configurable external proxy server to handle HTTP/2 requests. Advantage: Assets can be served via a server push while request is forwarded to application server for processing
  31. Cache digests is a proposed implementation to use a Bloom filter to inform the server of cached files Usually when CDN config and rendered page are out of sync. Managed by better engineering practices Not usually a worry but good to keep in mind