QUIC (Quick UDP Internet Connections) is an experimental transport layer network protocol initially designed, implemented, and deployed by Google in 2012.

QUIC is a completely new way of transmitting information over the Internet, built on top of the UDP protocol instead of the previously used TCP. The transition to UDP is the most interesting and powerful feature of the protocol, from which several other features follow.

Sonm is one of the first projects that has decided to introduce and use QUIC.

TCP, UDP, and QUIC

Today’s web is built on the TCP protocol, which was chosen for its reliability and guaranteed packet delivery. To open a TCP connection, the so-called “three-time handshake” is used, which means additional message sending/receiving cycles for each new connection, increasing latency. If you want to establish a secure TLS connection, you have to send even more packets.

UDP, on the other hand, is built on the idea of “sending a packet and forgetting about it.” A message sent via UDP will be delivered to the recipient (not guaranteed, with some limited probability of success). The clear advantage here is in the shorter connection setup time, but at the same time, the clear disadvantage is the lack of guarantee of delivery and the potentially disarrayed order of arrival of packets. This means that to ensure reliability, you have to build some mechanism over UDP to guarantee the delivery of packets.

And that’s where QUIC comes in. The QUIC protocol can open a connection and negotiate all TLS parameters (HTTPs) in 1 or 2 packets (depending on whether the connection is opened to a new server or to an already familiar one). This process dramatically speeds up the opening of the connection and the initiation of the data transmission.

Why we use QUIC

We use QUIC as an alternative to TCP to achieve reliable communication between our components. The QUIC protocol is now supported by most Sonm components.

The main reason we’ve included QUIC support is to increase the connection-establishing stability between any two peers located in private networks. QUIC is designed at top of UDP, which is more predictable and is investigated for NAT penetration, unlike we do for TCP in a hacky way (read about Sonm’s Double NAT penetration).

Since QUIC allows for many connections in a single socket, there is no need to penetrate the NAT for the same client-server pair multiple times. After the first successful attempt, the punched hole is reused.

Sonm component updates

The Rendezvous server has been updated to support UDP hole-punching using the QUIC protocol. It additionally exposes its gRPC server to the same UDP port as for TCP, since it is possible to reuse ports even if different network protocols are used. The wire level remains the same – gRPC.

The affected components are Worker, Node, and Rendezvous. Both Node and Worker now expose their gRPC services on both TCP and UDP sockets, using the same port number.

Finally, Windows users now can utilize our NAT-punching feature, since multiplexed UDP communication does not require the SO_REUSEPORT flag. Therefore, relaying is no longer the only option for Windows users.