HTTP/3

let's speed the web once more

VilniusPHP

I'll be talking about...

  • HTTP
  • TCP/IP
  • HTTP, again – from 1.0 to 3

Marius Balčytis

HTTP?

Request


POST /users HTTP/1.1
Accept: application/json, */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 16
Content-Type: application/json
Host: example.com
User-Agent: HTTPie/1.0.3

{
    "key": "value"
}
                    

Response


HTTP/1.1 200 OK
Cache-Control: must-revalidate, no-cache, no-store, private
Connection: keep-alive
Content-Encoding: gzip
Content-Type: application/json; charset=UTF-8
Date: Wed, 06 Nov 2019 17:58:42 GMT
Transfer-Encoding: chunked

{
    "id": 123,
    "key": "value"
}
                    

Timeline

  • HTTP/1.0 1996
  • HTTP/1.1 1997
  • HTTP/2 2015
    • HTTP/2 is used by 41.5% of all the websites.
  • HTTP/3 2020?

Why?

Performance! ⚡

TCP/IP stack

TCP/IP stack

Problems "below us"

  • Unreliable connection (WiFi etc)
  • Over-utilized devices
    • Packets are dropped when buffers overflow
  • Link congestion

TCP saves the day!

  • 1️⃣3️⃣2️⃣ ordered data transfer
  • 1️⃣💥3️⃣ retransmission of lost packets
  • 1️⃣🐛3️⃣ error-free data transfer
  • flow control and congestion control

UDP

  • source port – optional
  • destination port
  • length
  • checksum – optional

TLS 🔒

Back to HTTP!

HTTP/1.0 vs HTTP/1.1

Problems?

Wait for response before sending request

HTTP/1.1 vs HTTP/2

Problems?

Lost packets stop everything

HTTP/2 vs HTTP/3

QUIC

  • Based on UDP
  • Re-implements all the features provided by TCP
  • Supports streams
    • Connection ID
    • Always uses TLS 1.3
    • With TLS 1.3 data is sent after first round-trip or even with the first packet

Discovering an HTTP/3 Endpoint


                        Alt-Svc: h3-23=":443"; ma=86400
                    

QUIC gotchas

  • UDP is slow. In OS level – might be not noticeable
  • Firewall rules
  • Router NATing
  • Uses parts of TLS1.3, not built over it

Testing

  • CloudFlare
  • Nightly Chrome build
  • Patched nginx
  • Custom curl build

How protocols are created?

Guess who?

  • Has most servers
  • Has most popular browser
  • Has scale where it's worth optimizing core things
  • QUIC was created by Google
    • Same story with SPDY and HTTP/2
  • Presented for IETF 2018
  • 2017 was already used for 7% of worldwide traffic

Thanks, Google!

Further reading

Thanks! Questions?