HTTP/1.1 was introduced in 1999 and since then the web has changed. More people are accessing websites in mobile and tablets which have relatively slow connection and the number of external resources per page is increasing with causing increase in page load size. Although many HTTP clients and server side hacks had been implemented to make he web better but in the end every hack has its own consequences. Therefore there was need for a new protocol to make the web faster across multiple connection types and devices.
Difference between SPDY and HTTP/2
SPDY is a networking protocol introduced by Google in 2009. Its aim was to decrease web latency(time interval between request and response) and increase security.
HTTP/2 is a clone of SPDY. Google has now stopped developing SPDY and started working on HTTP/2 with the same ideas of SPDY.
Here is a list of objectives of HTTP/2 protocol:
- Reduce latency
- Reduce total number of TCP connections i.e., reduce number of open sockets
- Better web security.
- Maintain compatibility with HTTP/1.1 clients and server.
- Maintain same usability as HTTP/1.1 i.e., can be used wherever we use HTTP/1.1
- Better web security.
Here is a list of features of HTTP/2
- Multiplexing: Multiple asynchronous HTTP requests over a single TCP connection.
- Server Push: Multiple responses for single request
- Header Compression: Compress HTTP headers along with content.
- Request prioritization: While making multiple HTTP requests to a same domain they can be prioritized.
- Binary Protocol: HTTP/2 is binary protocol whereas HTTP/1.1 is text protocol.
What HTTP/1.1 problems does HTTP/2 Address
Here are the list of HTTP/1.1 problems solved by HTTP/2
- HTTP Pipelining: Some HTTP/1.1 clients have been using this technique to reduce the number of TCP connections. HTTP pipelining is a technique in which multiple HTTP requests are sent on a single TCP connection without waiting for the corresponding responses. But the server sends its responses in the same order that the requests were received — so the entire connection remains first-in-first-out and HOL blocking(delay of one response will delay other too) can occur. In HTTP pipelining parallel requests were made asynchronously but server responses synchronously. HTTP/2 solves this issue by introducing multiplexing, in which multiple requests and responses both are made asynchronously over a single TCP connection which indeed removes the HOL blocking issue.
- Multiple TCP Connections for Same Domain: In HTTP/1.1 there was need for multiple TCP connections to same domain to make multiple HTTP requests. But in HTTP/2 only one TCP connection per domain is allowed and all HTTP requests are made through that TCP connection asynchronously using multiplexing.
- TCP Connection Close Time: In HTTP/1.1 a TCP connection is closed as soon as the HTTP requests is finished. But in HTTP/2 the TCP connection can be live for a longer period of time.
- Header Compression: In HTTP/1.1 there was no header compression but in HTTP/2 there is header compression. Which decreases the latency further.
Here is a tutorial series on individual features and objectives of HTTP/2
HTTP/2 Compatibility with old Browsers and Servers
One of the biggest question that comes in is how is old browsers going to deal with HTTP/2 web servers and vice-versa.HTTP/2 uses an Upgrade and D ...Continue Reading
What is Multiplexing in HTTP/2?
Multiplexing is a method in HTTP/2 by which multiple HTTP requests can be sent and responses can be received asynchronously via a single TCP connectio ...Continue Reading
What is Server Push and Promises in HTTP/2?
Server push is a method in HTTP/2 which allows server to send multiple responses for a single request. This feature decreases the latency in loading a ...Continue Reading
Header Compression in HTTP/2
Headers in HTTP/2 provide information about the request or response. Header take around 800 bytes of bandwidth and sometimes few KB if it carries cook ...Continue Reading
HTTP/2 for WordPress Sites
HTTP/1.1 is a old protocol that is being used in modern websites which are very different from the websites of the time HTTP/1.1 was introduced. There ...Continue Reading