HTTP/2(HTTP/2.0) – The major second version of Hyper Text Transfer Protocol (network protocol) used by World Wide Web and introduced in 2015 by ‘httpbis’-the HTTP working group.
HTTP 1.1 was replaced by HTTP2 due to the following reasons.
HTTP 1.1 has hard time taking full advantage of all the power and performance that TCP offers.
HTTP clients and browsers have to be very creative to find solutions that decrease page loading time.
HTTP 1.1 is very latency sensitive, partly because HTTP Pipelining is still riddled with enough problems to remain switched off to a large percentage of users etc.
HTTP/2 gives the website a 30% performance gain without a complicated build and deploy process.
The aim behind the introduction of HTTP/2 is
To make the page loading faster – HTTP/2 loads web page elements quicker and more efficiently by using all available bandwidth.
To make resources more efficient.
To give the end user a far better experience.
HTTP/2 is designed backward-compatible with HTTP/1.1,so that developers of HTTP libraries don’t have to change APIs, and the developers who are using these libraries don’t have to change the application code which is working on the basis of SPDY protocol.
SPDY doesn’t replace HTTP, it is a for the protocol and modifies the way existing HTTP requests and responses are sent. It requires support from both the server and the browser connecting to that server.
How HTTP/2 Works
HTTP/2 brings new features such as
- Multiplexed Streams – eliminates the problem of making the assets such as texts,fonts,images etc into smaller parts and allow them to pass via single connection and reassemble them after they reached the final destination. HTTP/2 reduces the latency with multiplexing.
- Server Push – Represents a more efficient way to deliver the requested pages to a browser. In HTTP/2, pages which are sent are likely sent without any request. These requested pages go to the browser’s cache, and are available immediately if they’re needed.
- Compression of header – HTTP headers are those small piece of additional data attached to every request sent. Here in HTTP/2, all the headers are compressed as a block which is sent in unity and if the transfer is finished, the header block is decoded and is given back to the corresponding requests.
- Textual format replaced by Binary – The extra overhead caused by the textual format is followed by the slow loading of web pages. Binary format doesn’t require any parsing and so no overhead. Binary Frames are known to be the ‘fundamental u
nit’ of HTTP/2.
Requests for multiple assets on a single host use a single TCP connection in HTTP/2.
HTTP/2 also offers the following.
- Spriting Images : Combining multiple small images into one larger image.
- Domain Sharding : is the Splitting of Resources Between Hosts.For static assets requests were spread across several domains to increase the total number of open TCP connections allowed by the browser.
The HTTP Action
Once if the website is hosted on a server that supports HTTP/2, the decision of whether to continue optimizing for HTTP/1.1 or to optimize for HTTP/2 will come down to the protocol supported by the majority of the website users. HTTP/2 is backwards-compatible and so don’t need to do anything specific. The decision you need to make is when to optimize for it.
Prior case is to launch the website using a secure connection.
Prepare the website for HTTP/2 as to optimize it.
Check the user statistics of the website and check the percentage of benefit from HTTP/2 for the visitors.
Implement HTTP/2 optimization.
HTTP/2 is likely to provide significant performance advantages compared to raw HTTP/1.1 and it is an exciting new option for web applications. In general, sites will be more secure, simpler and will load faster.