DEV Community

loading...

What is HTTP & QUIC?

ldsrogan
I'm super interested in cool technologies!
Updated on ・4 min read

HTTP /0.9 ~/2 uses TCP

HTTP /0.9

It has only one method, GET.

Request

GET /index.html
Enter fullscreen mode Exit fullscreen mode

Response

<HTML>
Hello World
</HTML>
Enter fullscreen mode Exit fullscreen mode

HTTP /1.0

header is added.

Request

GET /index.html HTTP/1.0
User-Agent: NCSA_Mosic/2.0 (Windows 3.1)
Enter fullscreen mode Exit fullscreen mode

Response

Because header defines Content-Type, now it can send other types of data

200 OK
Date: Tue, 15 Nov 1995 05:12:22 GMT
Server: CERN/3.- libwww/2.17
Content-Type: text/html
<HTML>
Hello World
    <img src="/image.gif"/>
</HTML>
Enter fullscreen mode Exit fullscreen mode

The characteristic of the HTTP /1.0 is 1 Request & 1 Response Per Connection. This causes two main problems, 1. performance drops due to the new connection every time, and 2. cost inefficiency due to the server load.

HTTP /1.1

To solve the version 1. 0's limitations, 1.1 provides the functionality called Persistent Connection which allows to receive multiple requests and send multiple responses for certain amount of times by using timeout parameters. Also, 1.1 applies pipelining which allows the server not to wait for the response, but to receive all requests in order and responses at once in order. This reduces the delay time of the communication between the client and the server.

However, pipelining function causes a major problem called Head Of Line Blocking. Basically, if three requests were happened, and the initial request takes time to resolve, then the rest needs to be wait for the initial request to be resolved and be ready to respond.

image

Also, multiple requests may have the same header info which introduce the header duplication issue.

image

HTTP /2

HTTP /2 focus on the performance improvements compares to the prior HTTP /1.X. This version does not replace the standard protocol, but gives a meaning of extension. Currently, Naver, facebook, Instagram, and many others applied HTTP 2 protocol.

image

We can find changes in the message transferring method. HTTP /2 uses binary framing layer, and this allows to improve the transfer speed and lower the possibility of causing errors. As you see the diagram above, HTTP 2.0's message is designed to use the frame unit and encoded as binary (parsing and transferring speed is improved, and less error than handling strings).

This frame structure allows to ignore the order of requests and responses, and combine and split the frames depends on their speeds. This request and response multiplexing resolve the Head Of Line Blocking.

image

How To Find out protocol from the Web browser

  • Open inspector or development tool and choose network tab
  • Right click on the network table and choose protocol to add to the table

Stream in HTTP /2 also allows to set priority. Server can push the data that the client doesn't ask for.

HTTP /2 uses header compression to reduce the header size. To compress the duplicated header, it uses Huffman Encoding. This reduces the header size by 85% in general and also reduce the page loading time. (Testing in real time)

QUIC

QUIC is a transfer layer protocol like TCP and UDP. Google introduced the concept in 2013, and they use this as a default protocol for most of their products. QUIC is based on UDP.

TCP header holds lots of data that enable the data integrity and trust, but because of this, the speed of process is slow. On the other hand, UDP doesn't really hold much of data in the header, so it gives much faster performance and speed compares to TCP, but doesn't guarantee the integrity, trust, and the order of data. UDP is designed for the data transfer only, and there is no extra functions. Thus, this allows engineers to implement and add the needs to it. Google modified the UDP protocol to enhance the performance as well as the data integrity and trust like TCP.

QUIC sends the message with the initial settings and save the settings into cache to use repeatedly for the future request without handshake. one of the caching method from QUIC is using Connection UUID. This unique ID allows users to maintain their connectivity even if the IP address of the client becomes changed.

image

QUIC is secured. TLS is applied to QUIC by default, and QUIC uses Source Address Token to protect from IP Spoofing and Replay Attack. QUIC uses individual stream line, and this enhances the multiplexing function. (TCP uses the single stream line with parallel processing).

By using QUIC, Google reduce the loading time by 3 % in google.com, and enhance the buffering issues by 30% in youtube.com.

HTTP /3

HTTP 3(h3-29) was introduced in 2018, and it is based on QUIC, and Google is currently using it in their products.

Discussion (0)