Latency, TCP vs UDP and QUIC interview questions

6 networking interview questions on latency budgets, geography, TCP vs UDP and QUIC, each with the correct answer and a full explanation.

New York to Sydney is about 16,000 km. Light in fiber travels roughly 200,000 km/s. What is the best possible RTT, ignoring routing detours and processing?
Show answer

Answer

About 160 ms
One way is 16,000 / 200,000 = 80 ms, so a round trip is at least 160 ms. Real RTTs are higher because cables do not follow great circles. 80 ms is the one way figure, the most common mistake. 40 ms would need faster than light. 320 ms double counts the round trip.

Source: High Performance Browser Networking, Ilya Grigorik

An app server is in us-east. A user in Singapore (RTT 230 ms) loads a page that makes 3 sequential API calls, each needing one round trip on an already warm connection. The product team wants under 300 ms. What is the effective fix?
Show answer

Answer

Serve from a region near Singapore (or collapse the 3 calls into one and cache at the edge), because 3 x 230 ms is already 690 ms of pure RTT
Sequential round trips over a long RTT dominate; only fewer round trips or a shorter distance helps. Bandwidth does not reduce RTT for small requests. Faster serialization saves microseconds to milliseconds. Gzip shrinks bytes but small API responses already fit in a few packets.

Source: High Performance Browser Networking, Ilya Grigorik, Hello Interview, Networking Essentials

Mobile users reconnect often and each new connection costs TCP plus TLS handshakes on a 200 ms RTT. Which change cuts the most connection setup time for returning clients?
Show answer

Answer

Use TLS 1.3 session resumption, optionally with 0-RTT for idempotent requests, or HTTP/3 which combines transport and TLS setup
Resumption skips certificate work and 0-RTT lets data go with the first flight; QUIC merges the transport and crypto handshakes into 1 RTT. 0-RTT data can be replayed, so it is only for idempotent requests. Larger keys make the handshake slower. Nagle affects small writes on an open connection, not setup. A shorter TTL causes more DNS lookups, not fewer.

Source: RFC 8446 TLS 1.3, RFC 9000 QUIC

An interviewer asks: a page in Mumbai takes 1.8 s to first byte from your us-west origin. Break down where that time likely goes and what you would change first.
Show answer

Answer

Start with RTT (around 250 ms Mumbai to us-west). Cold path: DNS (maybe 1 RTT to a resolver plus authoritative), TCP 1 RTT, TLS 1 RTT, request 1 RTT, so roughly 1 s before server time. Add redirects (http to https, apex to www) at 1 RTT each, and slow server or DB work.

Fixes in order: CDN or edge termination near users (handshakes become local), remove redirects, connection reuse, TLS 1.3 or HTTP/3, then a regional deploy or edge cache for dynamic parts. Measure with timing breakdowns (curl -w or browser timing) before guessing.

Source: High Performance Browser Networking, Ilya Grigorik, ByteByteGo, What happens when you type google.com

A multiplayer game sends player positions 30 times a second. Why do many games use UDP (or QUIC datagrams) instead of TCP for this?
Show answer

Answer

TCP head of line blocking would hold new positions behind a lost old one; with UDP the game drops stale updates and uses the latest
TCP delivers bytes in order, so one lost segment stalls everything after it until retransmission, and a retransmitted old position is useless. UDP lets the app skip it. UDP packets do not travel faster on the wire; the 'faster' claim is the common wrong answer. UDP has no encryption. TCP can send small segments fine.

Source: RFC 8085 UDP Usage Guidelines, RFC 9293 Transmission Control Protocol

HTTP/2 multiplexes many streams over one TCP connection. On a lossy mobile network, one lost packet stalls all streams. What does HTTP/3 over QUIC change?
Show answer

Answer

Streams are independent at the transport layer, so a loss stalls only the affected stream, and connection setup combines transport and TLS
QUIC runs over UDP and does its own per stream reliable delivery, removing TCP level head of line blocking, and integrates TLS 1.3 into its 1 RTT handshake. QUIC is always encrypted. HTTP/3 uses one QUIC connection, not many TCP connections. QUIC has congestion control like TCP.

Source: RFC 9000 QUIC

These questions come from the Networking Interview Practice course in Bertopia.

More networking topics

Practise these on your commute