WHAT IS HTTP/2 AND HOW CAN IT BENEFIT YOUR WEBSITE
WHAT IS HTTP/2 AND HOW CAN IT BENEFIT YOUR WEBSITE
HTTP/2 is the latest update to the HTTP protocol by the Internet Engineering Task Force (IETF)
HTTP/2, the successor of HTTP1.x.
HTTP2 has been widely growing in popularity due to many of its performance benefits. As webpage sizes are growing and becoming more resource-intensive, it is vital to stay current with performance optimization techniques and strategies.
Why HTTP/2 rather than HTTP/1.1?
Single Connection
HTTP/2 can send multiple requests for data in parallel over a single TCP connection. This is the most advanced feature of the HTTP/2 protocol because it allows you to download web files asynchronously from one server. Most modern browsers limit TCP connections to one server.
Multiplexing
Multiple requests are allowed at the same time, on the same connection. Previously, with HTTP/1.1, each transfer would have to wait for other transfers to complete.
Binary Protocol
Earlier HTTP1 used to process text commands to complete requests. But HTTP2 is binary based that means (in 1s and 0s) to executes the same command.
Header Compression (HPACK)
HTTP2 compresses the header which reduces overheads.
Suppose once a client connected or used any server in past then HTTP2 uses that header information and reduces sending header with every request. As compared to HTTP1 many headers were send with every request.
Watch performance difference between HTTP/1 and HTTP/2
[HTTP/2 technology demo](http://www.http2demo.io/)
How to enable HTTP/2 in the Nginx server?
Now let’s activate HTTP2 for your websites and apps to improve performance.
chirag@chirag-MacBookAir:~$ vim /etc/nginx/nginx.conf listen 443 ssl; to listen 443 ssl http2; chirag@chirag-MacBookAir:~$ nginx -t chirag@chirag-MacBookAir:~$ systemctl restart nginx