Http/2 multiplexing and server push

Smart Techie

                 In this article, we will see the main features for Http/2 specification. Till Http/1 the request and response processing between the client and server is simplex. That is, the client sends the request and server processes that, sends the response back to the client. Then, the client sends another request to the server. If any of the requests are blocked, then all other requests will have the performance impact. This biggest issue is tackled by introducing the request pipeline in Http/1.1. As part of the request pipeline, the request will be sent in an order to the server. The server processes the multiple requests and sends the response back to the client in the same order. Again here the client and server communication is simplex. The below diagram depicts the client-server communication happening with Http/1.0 and Http/1.1.

http/1 request processing

                 Till Http/1.1 the request and response are composed in text format and uses multiple TCP connections per origin. The issues like opening multiple TCP connections per origin, Text format, simplex communication is handled in Http/ 2. Now we will see how Http 2 processes request and responses.

http2 request processing

                    The Http/2 uses a binary protocol to exchange the data. Http/2 opens a single connection per origin and the same TCP connection is used to process multiple requests. Each request will be associated with a stream and the request will be divided into multiple frames. Each frame will have the stream identifier to which it belongs to. The client will send multiple frames belongs to multiple streams to the server asynchronously and the server will process the frames belongs to multiple streams and sends the response asynchronously to the client. The client will arrange a response based on the stream identifier. Here the communication is happening between the client and server simultaneously without blocking.

              Another Http/2 feature is server push. When the client requests for a resource from the server, it pushes the additional resources along with the requested resources to the client to cache the data at the client side. This enhances the performance as the client cache is warmed up by the content.

http/2 server push

To know further about Http/2 go through the below links.

https://http2.github.io/

https://tools.ietf.org/html/rfc7540

http://royal.pingdom.com/2015/06/11/http2-new-protocol/

Siva Janapati is an Architect with experience in building Cloud Native Microservices architectures, Reactive Systems, Large scale distributed systems, and Serverless Systems. Siva has hands-on in architecture, design, and implementation of scalable systems using Cloud, Java, Go lang, Apache Kafka, Apache Solr, Spring, Spring Boot, Lightbend reactive tech stack, APIGEE edge & on-premise and other open-source, proprietary technologies. Expertise working with and building RESTful, GraphQL APIs. He has successfully delivered multiple applications in retail, telco, and financial services domains. He manages the GitHub(https://github.com/2013techsmarts) where he put the source code of his work related to his blog posts.

Tagged with: , ,
Posted in General
One comment on “Http/2 multiplexing and server push
  1. Alex says:

    Hi Siva. Great post about HTTP/2. You might be interested in an article I wrote covering the same subject https://www.ibm.com/developerworks/library/wa-http2-under-the-hood/index.html. I have also been writing about Servlet 4.0. I can send you those links if that is an area you are interested in. Cheers. Alex.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Dzone.com
DZone

DZone MVB

Java Code Geeks
Java Code Geeks
OpenSourceForYou