HTTP1 vs HTTP2: HTTP Protocol and Its Difference

Posted By Navin Purohit | 30-Apr-2019

HTTP/1 vs HTTP/2

 

Hypertext Transfer Protocol (HTTP) is a protocol that is the foundation of data communication for the World Wide Web. It is invented by Sir Timothy John Berners-Lee in 1989. HTTP is based on the Client/Server model. Client/Server model can be described as two computers, Client (receiver of service) and Server (provider of service) that are interacting via requests and responses.

A simple example would be a restaurant customer and a waiter. The customer (Client) asks (sends request) a waiter (Server) for a meal, then the waiter gets the meal from the restaurant chef (your application) and brings the meal to the customer.

 

What is SPDY?

Google was the first to inquire about issues with HTTP/1. They were spending millions of dollars to keep their data centers, and the HTTP/1 protocol cost too much in CPU resources and internet connection capacity. They developed SPDY as an alternative to HTTP/1—a protocol which has better security and improved page load times that would be the precursor to HTTP/2.

 

HTTP/2

In the year 2015, the Internet Engineering Task Force (IETF) releases its second major version of HTTP(the most useful internet protocol) i.e. HTTP/2. It was derived from the previous experimental SPDY protocol.


HTTP/2 Pros:-

1. Binary protocol instead of textual

2. Request multiplexing over a single TCP connection

3. Request pipelining

4. High-level compatibility with HTTP/1.1?—?methods, status codes, URIs and header fields.

5. Page load speed improvements 

6. Compression of request headers

7. HOL blocking (Head-of-line)?—?Package blocking

8. HTTP/2 Server Push


 

Let's describe a few of them:-

Request multiplexing

HTTP/2 can send multiple requests in parallel for data over a single CP connection. This is one of the most advanced features of the HTTP/2 protocol because it allows you to asynchronously download web files from one server. Most of the modern browsers limit TCP connections to one server. This decreases the additional round trip time (RTT), due to this website load faster without any optimization.


 


 

 

Header compression

HTTP/2 compress a large number of unnecessary header frames. HTTP/2 uses the HPACK specification for header compression which is a simple and secure approach. Both client and server keep a list of headers used in previous client-server requests.


 

Binary protocol

The latest HTTP version has expanded significantly in terms of capabilities and attributes such as altering from a text protocol to a binary protocol. HTTP1.x uses text commands to complete request-response cycles while HTTP/2 uses binary commands to execute the same tasks. This attribute eases issues with framing and simplifies the performance of commands that were intermixed as commands containing text and optional spaces.

Browsers having HTTP/2 implementation will convert the text commands into binary before sharing it over the network.


 

HTTP/2 Server Push

It allows the server to send additional cacheable information to the client that is not requested but is expected in future requests. For example, if the client requests for the resource X and it is recognized that resource Y is referenced with the requested file, So the server can send Y along with X instead of waiting for an appropriate client request for Y.


 

Conclusion

We can easily see that HTTP2 differs from HTTP1 in many ways with some features giving greater levels of control that can be used to better optimize web application implementation and some features that are an improvement on the previous protocol.

Request for Proposal

Recaptcha is required.

Sending message..