SlideShare a Scribd company logo
1 of 13
HTTP/2,
Differences and Performance Improvements with HTTP
AMIT BHAKAY
JUNE 07, 2017
HTTP (HyperText Transfer Protocol)
HTTP is a application layer, client-server network protocol, which works
on request-response mechanism, used to retrieve the information from
the web servers over the Internet.
HTTP works on TCP port 80 and uses 443 for secured connections (SSL)
Characteristics
- Stateless
- Connectionless
- Media Independent
Versions - 0.9, 1.0, 1.1, and 2.0
HTTP/1
Currently accepted version of HTTP - 1.0 and 1.1
HTTP 1.0 is a stateless and 1.1 is a stateful protocol.
HTTP 1.1 Features -
1. Extensibility
2. Caching
3. Bandwidth optimization
4. Network connection management
5. Message transmission
6. Internet address conservation
7. Error notification
8. Security, integrity, and authentication
9. Content negotiation
SPDY & HTTP/2
An experimental protocol developed by Google in 2009 to overcome, to reduce the web latency and
improve web security.
The primary goals for HTTP/2 are to reduce latency by enabling full request and response multiplexing,
minimize protocol overhead via efficient compression of HTTP header fields, and add support for request
prioritization and server push.
Browsers supported - Google Chrome, Mozilla Firefox, Apple Safari, Microsoft IE, Amazon Silk, Opera
SPDY reduces web latency through Compression, Multiplexing, Prioritization
IETF used SPDY to define HTTP/2
HTTP/2 - Differences with HTTP/1
- Binary, instead of textual
- Fully multiplexed, instead of ordered and blocking
- Can therefore use one connection for parallelism
- Uses header compression to reduce overhead
- Allows servers to “push” responses proactively into client caches
HTTP/2 - Connection Initiation & Termination
Server Response -
HTTP/1.1 101 Switching Protocols
Connection: Upgrade
Upgrade: h2c
A client that makes a request to an "https" URI uses TLS with the application-layer protocol negotiation (ALPN) extension (h2 for HTTP/2 using
TLS and h2c for HTTP/2 over clear text). Once the TLS negotiation is complete, both client and server must send the Connection Preface.
Connection Preface - Sequence of 24 Octets Hex value, sent immediately after 101 response, must be the first frame the server sends after
HTTP2 connection. It is the final confirmation that, the HTTP/2 will be used now for further communication.
0x505249202a20485454502f322e300d0a0d0a534d0d0a0d0a
Client Request -
GET / HTTP/1.1
Host: server.example.com
Connection: Upgrade, HTTP2-Settings
Upgrade: h2c
HTTP2-Settings: <base64url encoding of HTTP/2 SETTINGS payload>
HTTP/2 - Binary Framing & Frame Format
At the core of all performance enhancements of HTTP/2 is the new
binary framing layer, which dictates how the HTTP messages are
encapsulated and transferred between the client and server.
Both client and server must use the new binary encoding
mechanism to understand each other: an HTTP/1.x client won’t
understand an HTTP/2 only server, and vice versa.
HTTP/2 - Streams & Multiplexing
Stream is a bidirectional flow of bytes within an
established connection, which may carry one or
more messages.
Stream States:
- idle
- reserved(local), reserved(remote)
- half-closed(local), half-closed(remote)
- open, closed
Stream Identifiers - Client (Odd), Server (Even)
Concurrent Streams
(SETTINGS_MAX_CONCURRENT_STREAMS)
HTTP/2 - Flow Control & Stream Priority
Flow Control ensures that, 2 streams do not interfere with each other and is achieved with the
help of WINDOW_UPDATE frame.
Streams are multiplexed once the HTTP/2
message is split into individual frames.
Each stream may be assigned an integer weight
between 1 and 256.
Each stream may be given an explicit dependency
on another stream.
Error Handling -
- Connection Error - An error condition that renders the entire connection unusable
- Stream Error - An error with an individual stream
HTTP/2 - Server Push
It is the ability of the server to send multiple responses for a single client request. That is, in addition to the
response to the original request, the server can push additional resources to the client.
It uses PUSH_PROMISE frame, if the SETTINGS_ENABLE_PUSH is set to 1
Push resources can be
- Cached by the client
- Reused across different pages
- Multiplexed alongside other resources
- Prioritized by the server
- Declined by the client (RST_STREAM)
HTTP/2 - Terminologies & Error Codes
HTTP/2 Terminologies
- PING frame
- GOAWAY method
- CONNECT method
Error Codes - Error codes are used in RST_STREAM and GOAWAY frames to let the other
endpoint know the reason for connection or stream error.
Some common error codes are NO_ERROR(0x0), PROTOCOL_ERROR(0x1),
INTERNAL_ERROR(0x2), FLOW_CONTROL_ERROR(0x3), CANCEL(0x8),
SETTINGS_TIMED_OUT(0x4), FRAME_SIZE_ERROR(0x6), COMPRESSION_ERROR(0x9) etc.
HTTP/2 - Header Compression & HPACK
HTTP/2 compresses request and response header metadata using the
HPACK compression format that uses two simple but powerful
techniques:
1. It allows the transmitted header fields to be encoded via a static
Huffman code, which reduces their individual transfer size.
2. It requires that both the client and server maintain and update an
indexed list of previously seen header fields (in other words, it
establishes a shared compression context), which is then used as a
reference to efficiently encode previously transmitted values.
1. Static Table - It provides a list of common HTTP header fields that all connections are likely to use
(e.g., valid header names)
2. Dynamic Table - It s initially empty and is updated based on exchanged values within a particular
connection
HTTP/2 – Security Considerations
- Denial-of-Service attacks
- Pushed Response caching
- Intermediary Encapsulation attacks
- Server Authority
- Cross-Protocol attacks

More Related Content

What's hot

Simple Mail Transfer Protocol
Simple Mail Transfer ProtocolSimple Mail Transfer Protocol
Simple Mail Transfer ProtocolUjjayanta Bhaumik
 
Simple mail transfer protocol
Simple mail transfer protocolSimple mail transfer protocol
Simple mail transfer protocolAnagha Ghotkar
 
Hypertext Transfer Protocol
Hypertext Transfer ProtocolHypertext Transfer Protocol
Hypertext Transfer Protocolselvakumar_b1985
 
What is SMTP Server?
What is SMTP Server?What is SMTP Server?
What is SMTP Server?SMTPGET
 
Hypertext transfer protocol (http)
Hypertext transfer protocol (http)Hypertext transfer protocol (http)
Hypertext transfer protocol (http)Shimona Agarwal
 
Protocolos de E-mail (SMTP, POP e IMAP)
Protocolos de E-mail (SMTP, POP e IMAP)Protocolos de E-mail (SMTP, POP e IMAP)
Protocolos de E-mail (SMTP, POP e IMAP)Paulo Bischof
 
E mail transfer .74
E mail transfer .74E mail transfer .74
E mail transfer .74myrajendra
 
Information on protocols-email protocols
Information on protocols-email protocolsInformation on protocols-email protocols
Information on protocols-email protocolsPriyanka Shinde
 
E mail protocol - SMTP
E mail protocol - SMTPE mail protocol - SMTP
E mail protocol - SMTPMd Syed Ahamad
 
Introduction to HTTP - Hypertext Transfer Protocol
Introduction to HTTP - Hypertext Transfer ProtocolIntroduction to HTTP - Hypertext Transfer Protocol
Introduction to HTTP - Hypertext Transfer ProtocolSantiago Basulto
 
Group20 Dynamic Networks
Group20 Dynamic NetworksGroup20 Dynamic Networks
Group20 Dynamic Networkshariprasadnr
 
TCP WRAPPERS and XINETD
TCP WRAPPERS and XINETD TCP WRAPPERS and XINETD
TCP WRAPPERS and XINETD Tan Huynh Cong
 

What's hot (20)

HTTP Basics
HTTP BasicsHTTP Basics
HTTP Basics
 
Smtp
SmtpSmtp
Smtp
 
Simple Mail Transfer Protocol
Simple Mail Transfer ProtocolSimple Mail Transfer Protocol
Simple Mail Transfer Protocol
 
Simple mail transfer protocol
Simple mail transfer protocolSimple mail transfer protocol
Simple mail transfer protocol
 
Hypertext Transfer Protocol
Hypertext Transfer ProtocolHypertext Transfer Protocol
Hypertext Transfer Protocol
 
What is SMTP Server?
What is SMTP Server?What is SMTP Server?
What is SMTP Server?
 
Hypertext transfer protocol (http)
Hypertext transfer protocol (http)Hypertext transfer protocol (http)
Hypertext transfer protocol (http)
 
application layer
application layerapplication layer
application layer
 
Smtp
SmtpSmtp
Smtp
 
Protocolos de E-mail (SMTP, POP e IMAP)
Protocolos de E-mail (SMTP, POP e IMAP)Protocolos de E-mail (SMTP, POP e IMAP)
Protocolos de E-mail (SMTP, POP e IMAP)
 
E mail transfer .74
E mail transfer .74E mail transfer .74
E mail transfer .74
 
Information on protocols-email protocols
Information on protocols-email protocolsInformation on protocols-email protocols
Information on protocols-email protocols
 
Mail server setup
Mail server setupMail server setup
Mail server setup
 
E mail protocol - SMTP
E mail protocol - SMTPE mail protocol - SMTP
E mail protocol - SMTP
 
Smtp protocol
Smtp protocolSmtp protocol
Smtp protocol
 
Introduction to HTTP - Hypertext Transfer Protocol
Introduction to HTTP - Hypertext Transfer ProtocolIntroduction to HTTP - Hypertext Transfer Protocol
Introduction to HTTP - Hypertext Transfer Protocol
 
SNMP/SMTP/MIME
SNMP/SMTP/MIMESNMP/SMTP/MIME
SNMP/SMTP/MIME
 
Group20 Dynamic Networks
Group20 Dynamic NetworksGroup20 Dynamic Networks
Group20 Dynamic Networks
 
Mail server
Mail serverMail server
Mail server
 
TCP WRAPPERS and XINETD
TCP WRAPPERS and XINETD TCP WRAPPERS and XINETD
TCP WRAPPERS and XINETD
 

Similar to HTTP/2 - Differences and Performance Improvements with HTTP

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
 
HTTP/2 for Developers
HTTP/2 for DevelopersHTTP/2 for Developers
HTTP/2 for DevelopersSvetlin Nakov
 
The new (is it really ) api stack
The new (is it really ) api stackThe new (is it really ) api stack
The new (is it really ) api stackLuca Mattia Ferrari
 
Introduction to gRPC: A general RPC framework that puts mobile and HTTP/2 fir...
Introduction to gRPC: A general RPC framework that puts mobile and HTTP/2 fir...Introduction to gRPC: A general RPC framework that puts mobile and HTTP/2 fir...
Introduction to gRPC: A general RPC framework that puts mobile and HTTP/2 fir...Codemotion
 
Introduction to gRPC - Mete Atamel - Codemotion Rome 2017
Introduction to gRPC - Mete Atamel - Codemotion Rome 2017Introduction to gRPC - Mete Atamel - Codemotion Rome 2017
Introduction to gRPC - Mete Atamel - Codemotion Rome 2017Codemotion
 
HTTP/2 Introduction
HTTP/2 IntroductionHTTP/2 Introduction
HTTP/2 IntroductionWalter Liu
 
HTTP/2 - A brief introduction
HTTP/2 - A brief introductionHTTP/2 - A brief introduction
HTTP/2 - A brief introductionGibDevs
 
IRJET- An Overview of Web Sockets: The Future of Real-Time Communication
IRJET- An Overview of Web Sockets: The Future of Real-Time CommunicationIRJET- An Overview of Web Sockets: The Future of Real-Time Communication
IRJET- An Overview of Web Sockets: The Future of Real-Time CommunicationIRJET Journal
 
HTTP Request Smuggling
HTTP Request SmugglingHTTP Request Smuggling
HTTP Request SmugglingAkash Ashokan
 
HTTP request and response
HTTP request and responseHTTP request and response
HTTP request and responseSahil Agarwal
 
HTTP/2 standard for video streaming
HTTP/2 standard for video streamingHTTP/2 standard for video streaming
HTTP/2 standard for video streamingHung Thai Le
 

Similar to HTTP/2 - Differences and Performance Improvements with HTTP (20)

Http2
Http2Http2
Http2
 
Http/2
Http/2Http/2
Http/2
 
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 for Developers
HTTP/2 for DevelopersHTTP/2 for Developers
HTTP/2 for Developers
 
The new (is it really ) api stack
The new (is it really ) api stackThe new (is it really ) api stack
The new (is it really ) api stack
 
Introduction to gRPC: A general RPC framework that puts mobile and HTTP/2 fir...
Introduction to gRPC: A general RPC framework that puts mobile and HTTP/2 fir...Introduction to gRPC: A general RPC framework that puts mobile and HTTP/2 fir...
Introduction to gRPC: A general RPC framework that puts mobile and HTTP/2 fir...
 
HTTP
HTTPHTTP
HTTP
 
Introduction to gRPC - Mete Atamel - Codemotion Rome 2017
Introduction to gRPC - Mete Atamel - Codemotion Rome 2017Introduction to gRPC - Mete Atamel - Codemotion Rome 2017
Introduction to gRPC - Mete Atamel - Codemotion Rome 2017
 
HTTP/2 Introduction
HTTP/2 IntroductionHTTP/2 Introduction
HTTP/2 Introduction
 
Http2 kotlin
Http2   kotlinHttp2   kotlin
Http2 kotlin
 
HTTP
HTTPHTTP
HTTP
 
Introduction to HTTP2
Introduction to HTTP2Introduction to HTTP2
Introduction to HTTP2
 
HTTP/2 - A brief introduction
HTTP/2 - A brief introductionHTTP/2 - A brief introduction
HTTP/2 - A brief introduction
 
IRJET- An Overview of Web Sockets: The Future of Real-Time Communication
IRJET- An Overview of Web Sockets: The Future of Real-Time CommunicationIRJET- An Overview of Web Sockets: The Future of Real-Time Communication
IRJET- An Overview of Web Sockets: The Future of Real-Time Communication
 
Http methods
Http methodsHttp methods
Http methods
 
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
 
HTTP
HTTPHTTP
HTTP
 
HTTP request and response
HTTP request and responseHTTP request and response
HTTP request and response
 
HTTP/2 standard for video streaming
HTTP/2 standard for video streamingHTTP/2 standard for video streaming
HTTP/2 standard for video streaming
 

Recently uploaded

Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 

Recently uploaded (20)

Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 

HTTP/2 - Differences and Performance Improvements with HTTP

  • 1. HTTP/2, Differences and Performance Improvements with HTTP AMIT BHAKAY JUNE 07, 2017
  • 2. HTTP (HyperText Transfer Protocol) HTTP is a application layer, client-server network protocol, which works on request-response mechanism, used to retrieve the information from the web servers over the Internet. HTTP works on TCP port 80 and uses 443 for secured connections (SSL) Characteristics - Stateless - Connectionless - Media Independent Versions - 0.9, 1.0, 1.1, and 2.0
  • 3. HTTP/1 Currently accepted version of HTTP - 1.0 and 1.1 HTTP 1.0 is a stateless and 1.1 is a stateful protocol. HTTP 1.1 Features - 1. Extensibility 2. Caching 3. Bandwidth optimization 4. Network connection management 5. Message transmission 6. Internet address conservation 7. Error notification 8. Security, integrity, and authentication 9. Content negotiation
  • 4. SPDY & HTTP/2 An experimental protocol developed by Google in 2009 to overcome, to reduce the web latency and improve web security. The primary goals for HTTP/2 are to reduce latency by enabling full request and response multiplexing, minimize protocol overhead via efficient compression of HTTP header fields, and add support for request prioritization and server push. Browsers supported - Google Chrome, Mozilla Firefox, Apple Safari, Microsoft IE, Amazon Silk, Opera SPDY reduces web latency through Compression, Multiplexing, Prioritization IETF used SPDY to define HTTP/2
  • 5. HTTP/2 - Differences with HTTP/1 - Binary, instead of textual - Fully multiplexed, instead of ordered and blocking - Can therefore use one connection for parallelism - Uses header compression to reduce overhead - Allows servers to “push” responses proactively into client caches
  • 6. HTTP/2 - Connection Initiation & Termination Server Response - HTTP/1.1 101 Switching Protocols Connection: Upgrade Upgrade: h2c A client that makes a request to an "https" URI uses TLS with the application-layer protocol negotiation (ALPN) extension (h2 for HTTP/2 using TLS and h2c for HTTP/2 over clear text). Once the TLS negotiation is complete, both client and server must send the Connection Preface. Connection Preface - Sequence of 24 Octets Hex value, sent immediately after 101 response, must be the first frame the server sends after HTTP2 connection. It is the final confirmation that, the HTTP/2 will be used now for further communication. 0x505249202a20485454502f322e300d0a0d0a534d0d0a0d0a Client Request - GET / HTTP/1.1 Host: server.example.com Connection: Upgrade, HTTP2-Settings Upgrade: h2c HTTP2-Settings: <base64url encoding of HTTP/2 SETTINGS payload>
  • 7. HTTP/2 - Binary Framing & Frame Format At the core of all performance enhancements of HTTP/2 is the new binary framing layer, which dictates how the HTTP messages are encapsulated and transferred between the client and server. Both client and server must use the new binary encoding mechanism to understand each other: an HTTP/1.x client won’t understand an HTTP/2 only server, and vice versa.
  • 8. HTTP/2 - Streams & Multiplexing Stream is a bidirectional flow of bytes within an established connection, which may carry one or more messages. Stream States: - idle - reserved(local), reserved(remote) - half-closed(local), half-closed(remote) - open, closed Stream Identifiers - Client (Odd), Server (Even) Concurrent Streams (SETTINGS_MAX_CONCURRENT_STREAMS)
  • 9. HTTP/2 - Flow Control & Stream Priority Flow Control ensures that, 2 streams do not interfere with each other and is achieved with the help of WINDOW_UPDATE frame. Streams are multiplexed once the HTTP/2 message is split into individual frames. Each stream may be assigned an integer weight between 1 and 256. Each stream may be given an explicit dependency on another stream. Error Handling - - Connection Error - An error condition that renders the entire connection unusable - Stream Error - An error with an individual stream
  • 10. HTTP/2 - Server Push It is the ability of the server to send multiple responses for a single client request. That is, in addition to the response to the original request, the server can push additional resources to the client. It uses PUSH_PROMISE frame, if the SETTINGS_ENABLE_PUSH is set to 1 Push resources can be - Cached by the client - Reused across different pages - Multiplexed alongside other resources - Prioritized by the server - Declined by the client (RST_STREAM)
  • 11. HTTP/2 - Terminologies & Error Codes HTTP/2 Terminologies - PING frame - GOAWAY method - CONNECT method Error Codes - Error codes are used in RST_STREAM and GOAWAY frames to let the other endpoint know the reason for connection or stream error. Some common error codes are NO_ERROR(0x0), PROTOCOL_ERROR(0x1), INTERNAL_ERROR(0x2), FLOW_CONTROL_ERROR(0x3), CANCEL(0x8), SETTINGS_TIMED_OUT(0x4), FRAME_SIZE_ERROR(0x6), COMPRESSION_ERROR(0x9) etc.
  • 12. HTTP/2 - Header Compression & HPACK HTTP/2 compresses request and response header metadata using the HPACK compression format that uses two simple but powerful techniques: 1. It allows the transmitted header fields to be encoded via a static Huffman code, which reduces their individual transfer size. 2. It requires that both the client and server maintain and update an indexed list of previously seen header fields (in other words, it establishes a shared compression context), which is then used as a reference to efficiently encode previously transmitted values. 1. Static Table - It provides a list of common HTTP header fields that all connections are likely to use (e.g., valid header names) 2. Dynamic Table - It s initially empty and is updated based on exchanged values within a particular connection
  • 13. HTTP/2 – Security Considerations - Denial-of-Service attacks - Pushed Response caching - Intermediary Encapsulation attacks - Server Authority - Cross-Protocol attacks