HTTP / 2 - what is it? Easily explained
HTTP / 2 represents the future of the Internet. We'll explain to you as easily as possible in this practical tip.
HTTP / 2 - what is it?
HTTP (Hypertext Transfer Protocol) is responsible for transferring web pages from the World Wide Web to a browser. So if you want to display websites in your browser, they must first be loaded via HTTP. HTTP / 2 is the latest version and is the successor to HTTP / 1.1.
- Goal: Client and server communicate with each other when transferring websites. The client sends requests and the server replies to them. The new version is intended to accelerate client-server communication so that web pages load servers more quickly.
- Compatibility: HTTP / 2 should be backwards compatible with the previous version and not simply replace it.
New techniques from HTTP / 2
Websites have developed into complex documents that consist of many elements. The browser has to get style sheets, script files, images and advertisements from different hosts one after the other. Loading modern websites is becoming a challenge. The new technology is intended to remedy the situation.
- SPDY: Google is laying the foundation for the new web technology. The transmission protocol SPDY (speedy) is the first successor to HTTP / 1.1 and ensures shorter loading times in the browser. With its new version, HTTP specifies some improvements for SPDY.
- Multiplex method: In the future, HTTP / 2 should divide the data traffic on a TCP connection into streams. Messages consist of individual frames, the frame header containing the stream ID. The recipient can thus assign messages to individual streams, that is, demultiplex.
- Prioritization for streams: The server can weight which files are more important: either Script.js or Style.css. Important files are sent on a higher priority stream. This allows servers and clients to prioritize streams so that important resources can be loaded quickly.
- Server push: The server can transmit data on its own from the client, since it knows that the client will need this data soon. Files such as Script.js and Style.css are "pushed" from the server via a connection without the client's request.
- Compression procedure: Unnecessary information should be removed if possible. The frame header shrinks due to data compression. Above all, this shortens transmission times since the amount of data is reduced.
HTTP / 2 - compared to HTTP / 1.1
The protocol version HTTP / 1.1, released in 1999, has made some improvements to its predecessor. However, it is clearly out of date compared to HTTP / 2 because the old variant slows down the loading of websites.
- TCP connection: Data packets cannot be sent without TCP. HTTP / 1.1 sets up an unnecessarily large number of TCP connections in order to load all elements such as images, scripts or icons. HTTP / 2 uses only one connection over which data flows continuously. This shortens the loading times.
- Header: In HTTP / 1.1, headers are sent uncompressed - that is, each header contains unnecessary information that takes up a lot of space. HTTP / 2 is supposed to change that by transmitting the data in binary code.