Say Hello to HTTP/2

HTTP/1.x was born in 1999, and the web has evolved a lot in the last decade.  Because of HTTP/1.x, the web has many performance issues, and many developers have found hacks to overcome it. Below are some of the hacks which we used to improve the web performance.

  • As HTTP/1.x opens the new TCP connection for each request, downloading many files from the single server become more resource intensive causing a bottleneck for performance. To avoid it:

    • Use the CSS sprites, in which you download a bigger image containing the smaller images in it and show/hide at the client side.

    • Minify CSS and JS files and lossless compression of the images to reduce the number of bytes to download via network while reducing the resource download time.

    • Merge the multiple CSS and JS files into one, so that the number of requests will be reduced.

    • Host the assets like images into different domains or CDN, this way multiple servers will serve the content to the web page.

To help overcome performance problems addressed by the above-mentioned hacks, the Google team came up with SPDY(Pronounce as “SPEEDY”) protocol and the same technique is used as part of Google Chrome browser. Now, the same team thought to revamp HTTP/1.1 and proposed HTTP/2. The teams from Facebook, Amazon, and others came together  to be part of the Hypertext Transfer Protocol working group Internet Engineering Task Force(IETF).

 Now, Let's see what features 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 the client is asking).

  • Compression of HTTP headers.

  • Prioritization of resource (download the highest priority resource first, then the other one).

  • Binary framing layer (not compatible with HTTP/1.1)

Now, as web developers, we might have a lot of questions about adapting  HTTP/2. Below are few of the questions.

  1. Is there any change to the HTTP status codes, HTTP methods, Header fields, etc..?

  2. Do I need to change my code to adhere to HTTP/2?

  3. Do I need to change my web server to work with HTTP/2?

  4. Do I need to change the web browser to utilize HTTP/2?

As developers, we don't need to think about question 1 and 2 from the above list. There are no changes to HTTP status codes, HTTP methods, header fields, etc. and we don't need to change our code that is working for HTTP/1.1. HTTP/2 has 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 offer support for HTTP/2. Below is the information about the web servers and the browser releases.

Browsers

  • Mozilla Firefox provides 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

Webservers

  • IIS, on Windows 10 offers full support for HTTP/2

  • Since 2015, Nginx has been ready to support HTTP/2

  • Apache—not sure when HTTP/2 support will be provided

If you have any more info about HTTP/2, you can discuss as part of comments. Till then, Happy Exploring!


转载于:https://my.oschina.net/u/698683/blog/648840

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值