Before I dive into the main differences let me recollect the basic concepts like What is HTTP/ HTTP2? or What is protocol?
Protocol:
Protocol defines the rules for data communication mechanisms between clients and servers.
Three basic components that makes a protocol are:
- Header -- Provides info on size, type, source and destination addresses.
- Payload -- Actual message transmitted using protocol.
- Footer -- Similar to header, contains control fields.
Two most often used commands over HTTP:
Get - Requests data from a specified resource.
Post - Submits data to be processed to a specified resource.
Other methods include:
- HEAD - gets HTTP headers
- PUT - Uploads a representation of the specified URI
- DELETE - Deletes specified resource
- OPTIONS - Returns HTTP methods that server supports
- CONNECT - Converts request connection to a transparent TCP/IP tunnel
Why Improve HTTP?
With all these advantages and features why HTTP is not enough and what pushed to innovate to HTTP/2. Here are few limitations to notice in old version:
- HTTP processes only one request per TCP connection. Being synchronous HTTP/1.1 is forcing browsers to use multiple TCP connections to process multiple requests. Using multiple requests slows network performance for other users and results in:
- TCP Congestion
- Data Duplication
- Couple of techniques used by developers to improve performance are Domain Sharding, Concatenation, Data inlining, Multiple connections, Spriting etc..
- Poor resource prioritization degrades performance as the Web application grow in terms of complexity, functionality and scope and not to mention the other security loopholes.
What's up with HTTP/2?
All of the issues and workarounds are result of one fundamental issue(Synchronous requests) with HTTP/1.1. The new version HTTP/2 fixes this by firing all requests once and dealing with responses as they come in. HTTP/2 is binary rather than text based protocol which supports parallel multiplexed requests and response that do not block each other. Single TCP connection is used. Reduced latency, faster web performance and here's my favorite better SEO rankings :-). Though HTTP/2 server push is a good feature, It doesn't fit in for every website and its really premature at this point of time. Unlike HTTP/1.1 which process text commands to complete request-response cycles, latest version will use binary commands to execute same tasks. HTTP/2 uses HPACK specification to compress redundant headers which helps avoid pushing similar headers in each request as in HTTP/1.1. Here's a good comparison of differences between HTTP/1.x, SPDY(Google's response to address HTTP/1.x issues), HTTP/1.2 by Kinsta


With significant improvements in performance, security and availability. HTTP/2 may become the default protocol to transfer data.
Browser Support:
- Chrome
- Firefox
- Apple Safari
- IE - IE8 and above
- and I'm sure there's more being added to the list.
Thanks to awesome folks @Tune the Web and @Kinsta and of course Google for helping me improve my understanding on HTTP/2.
Comments
Post a Comment