The HTTP/1.x was born in 1999 and the web is evolved a lot in the last decade. As part of HTTP/1.x the web has performance issues and the developers found the hacks to overcome it. Below are some of the hacks which we used.
- As HTTP/1.x opens the new TCP connection for each request, downloading many files from the single server become more resource intensive and the bottleneck for performance. To avoid it,
- Used the CSS sprites, in which download the bigger image containing the small images in it and show/hide at the client side.
- Minifying CSS and JS files and loss less compression of the images to reduce the download time.
- Merging the multiple CSS and JS files into one, so that the number of requests will be reduced.
- Hosting the assets like images in to different domains. So that the multiple servers will serve the content to the web page.
To overcome with all the above said hacks google team came up with SPDY (Pronounce as “SPEEDY”) protocol and which is used as part of Google Chrome browsers. Now, the same team thought to revamp HTTP/1.1 and proposed HTTP/2. The teams from Facebook, Amazon and others came forward and part of the Hypertext Transfer Protocol working group Internet Engineering Task Force(IETF).
Now, Let us see what features the HTTP/2 will provide.
- Multiplexing (Open a single TCP connection and reuse the same for other requests).
- Server Push (Pushing the content from the server to user agent, before it is asking).
- Compression of HTTP headers.
- Prioritization of resource (download the highest priority resource first than the other one).
- Binary framing layer (not compatible with HTTP/1.1)
Now, as web developers we get lot of questions on adapting of HTTP/2. Below are couples of the questions.
- Is there any change to the HTTP status codes, HTTP methods, Header fields etc..?
- Do I need to change my code to adhere to HTTP/2?
- Do I need to change my web server to work with HTTP/2?
- Do I need to change the web browser to utilize HTTP/2?
As developers we no need to think about the question 1 and question 2. There are no changes to HTTP status codes, HTTP methods, header fields etc … We no need to change the code which is working for HTTP/1.1. The HTTP/2 is having backward compatibility to work with HTTP/1.1. For Question 3 and 4, yes we need to change the web server and the browser to support for HTTP/2. Below is the information of the web servers and the browser releases.
- Mozilla Firefox providing support for HTTP/2 from Firefox release 36.
- Google chrome provided support from release 40 onward.
- Safari 8
- Internet Explorer supports HTTP/2 in version 11, but only for Windows 10 beta.
- IIS, on Windows 10 full support for HTTP/2
- By 2015 Nginx is ready to support HTTP/2
- Apache, not sure when HTTP/2 support is provided.
If you have any more info on HTTP/2, you can discuss as part of comments. Till then, Happy Exploring!!!