A DNS lookup is the smallest exchange most applications make: a question of about 40 bytes, an answer of about 60. Plain DNS sends both in one UDP packet each, unencrypted, readable and rewritable by anything on the path. The encrypted alternatives wrap the same message in TLS: DoT (DNS over TLS, RFC 7858) on a TCP connection, DoH (DNS over HTTPS, RFC 8484) as an HTTP request, and DoQ (DNS over QUIC, RFC 9250) on a QUIC stream. How the name itself gets resolved, root to TLD to authoritative server, is in the DNS resolution simulator; this benchmark is about the last hop, the transport, and what each one costs per lookup.
Everything below was measured on one machine, in Docker, against one CoreDNS server that serves the same zone on all five transports, with the same certificate and the same emulated links. Every answer is checked against the zone file the server loads: 36,767,117 answers, none wrong.
Setup
Details
Server
CoreDNS 1.15.0 (coredns/coredns:1.15.0, Go 1.27.3), one process, the file plugin serving one local zone, bench.test, on five listeners: UDP and TCP :53, DoT :853/TCP, DoQ :853/UDP, DoH over HTTP/2 :443/TCP and over HTTP/3 :443/UDP · everything else at defaults · no recursion, no cache, no internet
Zone
Signed with DNSSEC (ECDSA P-256 keys). Small question: a.bench.test A, one record, no DNSSEC requested. Large question: big.bench.test AAAA with the DO bit, 64 records and their signature: a 3,008-byte answer
Client
Go 1.27.2, miekg/dns 1.1.73 for messages, plain sockets for UDP and TCP, crypto/tls for DoT, golang.org/x/net/http2 0.62.0 and quic-go 0.64.1 (http3) for DoH, quic-go for DoQ. DoH sends POST application/dns-message. One query per stream on QUIC; DoT and TCP pipeline queries on one connection and match answers by ID
Queries
EDNS(0) with a 1,232-byte buffer (DNS Flag Day 2020) on UDP, TCP, DoT and DoH; 65,535 on DoQ and DoH over HTTP/3 (see large answers) · UDP resends after 1 s without an answer; a truncated UDP answer is asked again over a new TCP connection
Check
The client parses the same signed zone file the server loads; every answer’s records, sorted, must hash (SHA-256) to the zone’s records for that name and type, plus the signature when DNSSEC was asked for. A missing, extra, changed or truncated record fails the run
TLS
1.3 everywhere, one ECDSA P-256 certificate, AES-128-GCM, key exchange X25519MLKEM768 (Go’s default, on TCP and QUIC alike), no session resumption and no 0-RTT: every new connection does a full handshake
Network
One network namespace, IPv4 loopback at a 1,500-byte MTU with segmentation offloads and UDP GSO off, so packets have real sizes · links emulated with tc netem: LAN (nothing added), 50 ms round trip, 200 ms round trip with 1 % random loss in each direction, 50 ms round trip with 5 % loss in each direction
CPU
AMD Ryzen AI Max+ 395 · server on cores 2–3, client on cores 4–7, on a CCD reserved for the benchmark
Method
Every cell is a fresh client process, run 10 times · reported value: median of the 10 runs (mean of the two middle ones), min–max where it matters · latency: median of the run medians, and the mean over every lookup of every run · slowest 1 %: each run’s 99th percentile, median across runs · bytes from the interface counters, every IP packet both ways, before and after · a wait for a quiet link before every cell
The scoreboard
Eight headline measures from the sections below, each transport's median as a multiple of the best median for that measure (1×; log scale, a longer bar is worse), labelled with the measured value. Median of 10 process runs; grey line: lowest to highest run. The loss row is the mean over every lookup, where the lost packets show. Plain UDP has no connection; its new-connection rows are the same single round trip, and its large answer is the truncated reply plus the retry over TCP.Eight headline measures from the sections below, each transport's median as a multiple of the best median for that measure (1×; log scale, a longer bar is worse), labelled with the measured value. Median of 10 process runs; grey line: lowest to highest run. The loss row is the mean over every lookup, where the lost packets show. Plain UDP has no connection; its new-connection rows are the same single round trip, and its large answer is the truncated reply plus the retry over TCP.
Measure
UDP
TCP
DoT
DoH, HTTP/2
DoH, HTTP/3
DoQ
Small answer, reused connection, LAN
14 µs 14–16 µs
11 µs 11–15 µs · 1.3×
11 µs 11–14 µs · 1.3×
39 µs 38–41 µs · 0.37×
43 µs 42–45 µs · 0.33×
27 µs 26–28 µs · 0.52×
Small answer, new connection, 50 ms link
50.6 ms 50.1–50.7 ms
101 ms 100–101 ms · 0.50×
152 ms 151–153 ms · 0.33×
153 ms 151–153 ms · 0.33×
103 ms 102–103 ms · 0.49×
103 ms 102–103 ms · 0.49×
Large answer, reused connection, 50 ms link
151 ms 150–151 ms
50.3 ms 50.1–50.6 ms · 3.0×
50.3 ms 50.1–50.6 ms · 3.0×
50.5 ms 50.2–50.9 ms · 3.0×
50.6 ms 50.2–50.9 ms · 3.0×
50.4 ms 50.2–50.7 ms · 3.0×
Mean lookup at 5 % loss, 50 ms link
125 ms 50.3–351 ms
70.8 ms 56.5–91.5 ms · 1.8×
78.7 ms 56.9–117 ms · 1.6×
96.1 ms 62.7–112 ms · 1.3×
59.2 ms 54.1–73.2 ms · 2.1×
59.4 ms 54.3–66.6 ms · 2.1×
Bytes per query, reused connection
203 B 203 B
256 B 256 B · 0.79×
300 B 300 B · 0.68×
600 B 600 B · 0.34×
495 B 483–505 B · 0.41×
390 B 375–398 B · 0.52×
Bytes per query, new connection
203 B 203 B
687 B 687 B · 0.30×
4,672 B 4,659–4,688 B · 0.043×
5,566 B 5,560–5,572 B · 0.036×
7,022 B 7,010–7,053 B · 0.029×
6,819 B 6,805–6,822 B · 0.03×
Queries/s on one connection, LAN
307,136 301,919–311,323
272,002 268,237–273,713 · 0.89×
305,057 300,835–306,624 · 0.99×
65,220 64,573–66,328 · 0.21×
105,665 103,428–106,429 · 0.34×
161,516 157,121–165,496 · 0.53×
Queries/s on one connection, 200 ms, 1 % loss
449 437–455
245 225–270 · 0.55×
255 228–286 · 0.57×
230 221–260 · 0.51×
436 422–460 · 0.97×
460 433–476 · same
Median of 10 process runs, lowest to highest run beneath; bold: best in every run; after the range, the factor against UDP: above 1× better than UDP, below 1× worse, same: rounds to 1×.
Counting a measure only where every run agrees, against UDP: TCP is better on 1 (up to 3.0× on large answer, reused connection, 50 ms link), worse on 5 (down to 0.30× on bytes per query, new connection) and ties on 2; DoT is better on 2 (up to 3.0× on large answer, reused connection, 50 ms link), worse on 5 (down to 0.043× on bytes per query, new connection) and ties on 1; DoH, HTTP/2 is better on 1 (up to 3.0× on large answer, reused connection, 50 ms link), worse on 6 (down to 0.036× on bytes per query, new connection) and ties on 1; DoH, HTTP/3 is better on 1 (up to 3.0× on large answer, reused connection, 50 ms link), worse on 5 (down to 0.029× on bytes per query, new connection) and ties on 2; DoQ is better on 1 (up to 3.0× on large answer, reused connection, 50 ms link), worse on 5 (down to 0.03× on bytes per query, new connection) and ties on 2. The sections below take each measure in turn, with the other links, the slowest 1 %, idle connections and the runs behind every median.
Each transport's median against plain UDP's on the same measure, log scale; above 1× it is better than UDP (faster, fewer bytes or more queries a second). Median of 10 process runs.Each transport's median against plain UDP's on the same measure, log scale; above 1× it is better than UDP (faster, fewer bytes or more queries a second). Median of 10 process runs.
A new connection against a reused one
Plain DNS over UDP has no connection: the question goes out, the answer comes back, one round trip. Every encrypted transport first has to set one up, and how many round trips that takes is the first thing that separates them. The same small question on each transport, once on a connection that is already open and once on a new one, handshake included:
One query at a time, from sending it until the verified answer is in. Reused: the connection was opened and used once before the clock starts. New: the clock includes opening the connection (TCP and TLS 1.3 handshakes, or the QUIC handshake), and the connection is closed after the answer. Plain UDP has no connection, so both are one round trip. Median of 10 process runs × 50–200 queries; each link has its own scale. The 50 ms link with 5 % loss gave the same medians; it is in the table below.One query at a time, from sending it until the verified answer is in. Reused: the connection was opened and used once before the clock starts. New: the clock includes opening the connection (TCP and TLS 1.3 handshakes, or the QUIC handshake), and the connection is closed after the answer. Plain UDP has no connection, so both are one round trip. Median of 10 process runs × 50–200 queries; each link has its own scale. The 50 ms link with 5 % loss gave the same medians; it is in the table below.
On a reused connection all six answer in one round trip, 50.4 ms to 50.7 ms on the 50 ms link. Encryption on an open connection costs microseconds of CPU, not round trips. On a new connection the transports split by how they start:
TCP + TLS (DoT, DoH over HTTP/2): 3 round trips. The TCP handshake, the TLS 1.3 handshake, then the query: 152 ms and 153 ms at 50 ms.
QUIC (DoQ, DoH over HTTP/3): 2 round trips. QUIC carries the TLS handshake inside its own, so transport and encryption are set up together: 103 ms and 103 ms.
Plain TCP: 2 round trips, 101 ms: the handshake and the query.
On the LAN the round trips vanish and what is left is CPU: a reused DoT connection answers in 11 µs, a new one in 436 µs, almost all of it the handshake’s cryptography. QUIC is slower to set up here (597 µs for DoQ): quic-go handles every packet in user space, where TCP’s part of the work is done by the kernel.
The full table, median and, below it, the mean over every lookup of every run, which is where lost packets show:
Median · mean
LAN, no added delay
50 ms RTT
200 ms RTT, 1 % loss
50 ms RTT, 5 % loss
UDP
14 µs 20 µs
50.5 ms 50.5 ms
200 ms 217 ms
50.2 ms 125 ms
TCP, reused
11 µs 17 µs
50.5 ms 50.4 ms
200 ms 217 ms
50.3 ms 70.8 ms
TCP, new conn.
29 µs 45 µs
101 ms 101 ms
401 ms 434 ms
100 ms 221 ms
DoT, reused
11 µs 16 µs
50.5 ms 50.5 ms
200 ms 210 ms
50.4 ms 78.7 ms
DoT, new conn.
436 µs 474 µs
152 ms 152 ms
602 ms 658 ms
152 ms 332 ms
DoH, HTTP/2, reused
39 µs 51 µs
50.5 ms 50.6 ms
201 ms 212 ms
50.5 ms 96.1 ms
DoH, HTTP/2, new conn.
504 µs 551 µs
153 ms 152 ms
603 ms 674 ms
153 ms 341 ms
DoH, HTTP/3, reused
43 µs 53 µs
50.7 ms 50.6 ms
201 ms 211 ms
50.5 ms 59.2 ms
DoH, HTTP/3, new conn.
635 µs 710 µs
103 ms 103 ms
403 ms 430 ms
103 ms 156 ms
DoQ, reused
27 µs 33 µs
50.4 ms 50.4 ms
200 ms 209 ms
50.3 ms 59.4 ms
DoQ, new conn.
597 µs 665 µs
103 ms 103 ms
402 ms 443 ms
103 ms 159 ms
Bytes and packets per query
On the wire, the same split. A query and its answer on the LAN, every IP packet in both directions counted:
Network interface counters before and after 200 queries on a reused connection or 50 on new ones (handshake and close included), divided by the number of queries; every IP packet in both directions, headers included. Median of 10 process runs. The large answer is 3,008 B of DNS (64 AAAA records, DNSSEC-signed).Network interface counters before and after 200 queries on a reused connection or 50 on new ones (handshake and close included), divided by the number of queries; every IP packet in both directions, headers included. Median of 10 process runs. The large answer is 3,008 B of DNS (64 AAAA records, DNSSEC-signed).
Plain UDP is 203 B in 2 packets: the question, the answer, 28 bytes of IP and UDP header on each. On a reused connection the encrypted transports add little: DoT 300 B (a 22-byte TLS record wrapper each way and TCP’s acknowledgements), DoQ 390 B and DoH over HTTP/2 600 B, which also carries HTTP headers and frames.
A new connection is another matter: 4,672 B for DoT, 6,819 B for DoQ, 7,022 B for DoH over HTTP/3, 23× to 35× the UDP exchange. Most of it is the TLS handshake: Go offers the post-quantum hybrid key exchange X25519MLKEM768 by default, whose key shares are 1,216 bytes in the ClientHello and 1,120 in the ServerHello, plus the certificate. QUIC adds its own rule on top: a client’s first packets must be padded to at least 1,200 bytes, so a server cannot be used to amplify traffic towards a forged address.
A resolver that opens a connection per lookup pays this every time. One that keeps it open pays it once, which is why the idle cost below matters.
Large answers
DNSSEC signatures, long TXT records and many-address answers make responses big. Since DNS Flag Day 2020, resolvers advertise a 1,232-byte EDNS buffer, small enough to never be fragmented on any normal path. A larger answer over UDP comes back truncated, with the TC bit set, and the client must ask again over TCP. Over a connection that is already open, nothing of the sort happens.
Every query carries EDNS(0) with the 1,232-byte buffer of DNS Flag Day 2020. Over UDP the server sets the TC bit and the client asks again over a new TCP connection, as stub resolvers do. Median of 10 process runs.Every query carries EDNS(0) with the 1,232-byte buffer of DNS Flag Day 2020. Over UDP the server sets the TC bit and the client asks again over a new TCP connection, as stub resolvers do. Median of 10 process runs.
The UDP path costs 151 ms on the 50 ms link, 3 round trips: the truncated answer, the TCP handshake, the question again. That is the same as opening a new DoT connection, and it costs 5,113 B on the wire, more than DoT on an open connection (3,356 B). On the lossy 200 ms link: 601 ms against 200 ms for an open DoT connection.
One server behaviour came out of the check. With the same 1,232-byte buffer that every other query carries, CoreDNS 1.15.0 truncated the large answer on both QUIC transports as if they were UDP:
Large answer, EDNS buffer 1,232 B
TC bit set
Answer records
TCP
no
65 of 65
DoT
no
65 of 65
DoH, HTTP/2
no
65 of 65
DoH, HTTP/3
yes
42 of 65
DoQ
yes
42 of 65
RFC 9250 §4.6 says the EDNS buffer size “is ignored by DoQ” and that DoQ implementations always assume 65,535 bytes. A client that follows the RFC and sends the usual 1,232 gets 42 of 65 records with the TC bit, and nowhere obvious to retry: it is already on an encrypted connection. Every check in this benchmark caught it as a wrong answer, so the DoQ and HTTP/3 measurements send a 65,535-byte buffer, which CoreDNS honours. If you run DoQ or DoH over HTTP/3 on CoreDNS, set the client’s buffer size accordingly, or DNSSEC answers will arrive incomplete.
Packet loss
Loss is where transports differ most, and where plain UDP’s simplicity costs: it has no retransmission of its own. If the question or the answer is lost, the client waits for a timeout and asks again. The client here waits 1 s; glibc’s resolver, the default on most Linux systems, waits 5 s.
Same measurement as the first figure, reused connections, with random loss in each direction. Solid: median of the 10 run medians; light: mean over all 300 and 400 lookups of the 10 runs, where the lost ones show; grey line: the lowest to the highest of the 10 run means, so bars whose lines overlap swap places from run to run. The UDP client resends after 1 s without an answer; TCP and QUIC retransmit on their own timers.Same measurement as the first figure, reused connections, with random loss in each direction. Solid: median of the 10 run medians; light: mean over all 300 and 400 lookups of the 10 runs, where the lost ones show; grey line: the lowest to the highest of the 10 run means, so bars whose lines overlap swap places from run to run. The UDP client resends after 1 s without an answer; TCP and QUIC retransmit on their own timers.
The median is the round trip on every transport and both lossy links; loss shows in the average. At 1 % loss in each direction it costs little: on the 200 ms link the six means are 209–217 ms, and with 30 lookups a run, of which 0–2 are hit, their order changes from run to run. At 5 % in each direction about one UDP lookup in ten loses its question or its answer and waits the full second: 125 ms on average, 50–351 ms across runs, and the slowest 1 % of each run took 1,051 ms. TCP and QUIC resend on timers derived from the measured round trip: DoT averages 78.7 ms (slowest 1 %: 323 ms), DoQ 59.4 ms (143 ms). DoH over HTTP/2 rides the same TCP as DoT and averaged 96.1 ms; each lookup is 6 packets instead of 2, so more of them can be lost, but the two swap places between runs (DoT 57–117 ms, DoH 63–112 ms), so that is a hint, not a result.
New connections suffer more: a lost handshake packet costs TCP a 1 s SYN timeout and QUIC its probe timeout. At 5 % loss a lookup on a new DoT connection averages 332 ms (slowest 1 %: 1,167 ms), on a new DoQ connection 159 ms (396 ms): fewer packets in the handshake, fewer to lose.
Some never finish. CoreDNS does not wait indefinitely for a slow connection: when the handshake and the query were still incomplete about 4 s after the client started, the server closed the connection without an answer (the client sees EOF). That happened to 2 of the new-connection lookups in the whole benchmark, all at 5 % loss (DoH, HTTP/2, new connection, small answer, 50 ms, 5 % loss: 1 of 20; DoT, new connection, large answer, 50 ms, 5 % loss: 1 of 20). Each cell run with such a failure was repeated once, so the numbers above count only completed runs; a real client would have to start over, after already losing those seconds.
Queries per second on one connection
A busy forwarder sends many lookups over one upstream connection. Here the client keeps 100 queries in flight on a single connection for 3 s on the LAN and 10 s on the lossy link and counts verified answers per second:
Queries/s, one connection 100 in flight
LAN
200 ms 1 % loss
UDP
307,136 301,919–311,323
449 437–455
TCP
272,002 268,237–273,713
245 225–270
DoT
305,057 300,835–306,624
255 228–286
DoH, HTTP/2
65,220 64,573–66,328
230 221–260
DoH, HTTP/3
105,665 103,428–106,429
436 422–460
DoQ
161,516 157,121–165,496
460 433–476
On the LAN this measures software, the server on two cores. DoT and plain TCP pipeline: the client writes queries back to back and CoreDNS answers them in order on the one connection, 305,057 a second for DoT. DoQ opens one QUIC stream per query (161,516 a second); DoH pays for HTTP on top: 65,220 a second over HTTP/2 and 105,665 over HTTP/3. UDP from one socket reached 307,136.
On the lossy 200 ms link it measures how loss on one connection affects the other 99 queries. On TCP, a lost segment holds back everything behind it until it is retransmitted (head-of-line blocking): 255 queries a second for DoT. QUIC streams are independent, so a lost packet only delays the queries in it: 460 for DoQ. UDP: 449, since only the lost query itself waits for its 1 s resend. With 100 in flight on a 200 ms round trip, 500 a second is the ceiling for any of them.
Idle connections
Keeping a connection open makes every later lookup one round trip. How long does the server let it stay open? Each cell opened 100 connections, sent one query on each and left them idle for 15 s:
Held idle 15 s
Server closed it after
Still usable
Server RSS growth per connection
Bytes in 15 s
TCP
9.9 s
0 of 100
0 KB 0 to 11
104 B
DoT
9.9 s
0 of 100
14 KB 6 to 37
232 B
DoH, HTTP/2
9.9 s
0 of 100
5 KB 0 to 14
347 B
DoH, HTTP/3
10.0 s
0 of 100
28 KB 20 to 49
452 B
DoQ
10.0 s
0 of 100
6 KB -5 to 22
402 B
CoreDNS closes every idle connection, on all five connection-based transports, after about 10 s. A client that wants a warm connection must either send something more often than that, or reconnect, paying the handshake of the bytes section again. RFC 7858 suggests that DoT clients keep connections open, and RFC 7828’s edns-tcp-keepalive option lets a server announce a longer timeout; the client here did not ask for it, so these are the server’s defaults. While open, a connection costs the server little memory: CoreDNS’s resident memory grew by 14 KB per held DoT connection and 28 KB per HTTP/3 connection (median, 100 held). It is a coarse measure, since Go’s runtime takes and returns memory in large steps, as the min–max spread shows.
What this does not show
A recursive resolver. The server answers from a local zone; a real resolver also spends time asking upstream servers on a cache miss. That time is the same for every transport and would dwarf most of the differences here on a miss.
Session resumption and 0-RTT. TLS resumption skips the certificate and most of the key exchange on a reconnect, and QUIC’s 0-RTT can send the query with the first packet. Neither was used, so every new connection here is the worst case.
Real loss and real paths.netem drops packets independently at random; real links lose in bursts. Middleboxes that block UDP port 853 or QUIC push clients back to TCP, which is one reason DoH over HTTP/2 on port 443 is the most deployed.
Padding. RFC 8467 recommends padding encrypted DNS messages (queries to 128 bytes, answers to 468) so sizes leak less; neither side padded here, which keeps the encrypted transports’ byte counts lower than in a privacy-tuned deployment.
Other servers and clients. One server (CoreDNS) and one client stack (Go). Unbound, Knot Resolver, dnsdist or BIND, and clients written in C, would put different numbers on the CPU-bound rows; the round-trip counts would not change.
Loopback CPU. Client and server share one machine; on the LAN rows both sides’ CPU time is in the latency.
What the numbers say
On a reused connection, encryption costs no round trips: every transport answers in one, within 187 µs of UDP on a 50 ms link.
A new connection costs 3 round trips over TCP + TLS and 2 over QUIC, and 23×–35× the bytes of a UDP lookup. Keep connections open.
A DNSSEC answer over 1,232 bytes costs plain DNS 3 round trips (truncation, then TCP); on an open encrypted connection, one.
Under heavy loss a lost UDP packet waits the full 1 s resend timer, so UDP’s average swings with the loss count (50–351 ms across runs at 5 %); TCP and QUIC retransmit within a few round trips (56–117 ms and 54–73 ms).
On one busy connection with loss, QUIC’s independent streams beat TCP’s head-of-line blocking.
CoreDNS closes idle encrypted connections after about 10 s and truncates DoQ and DoH-over-HTTP/3 answers to the UDP buffer size; check both if you deploy it.
Reproduce it
The harness is a Go client (dq), a Corefile, a zone and a driver script. It builds one image, starts CoreDNS in the client’s network namespace, and runs every cell as a fresh client process:
./setup.sh # throwaway CA + certificate, DNSSEC-signed zonedocker build -t dqb . # Go build of the client./up.sh 4-7 2-3 # client cores, server coresdocker exec dns-net tc qdisc replace dev lo root netem delay 25ms limit 100000 # the 50 ms linkdocker exec dns-net dq -test lat -tr doq -q small -mode cold -n 20 -settle 300ms
Each run prints one JSON line: latency percentiles, handshake time, bytes and packets per query, UDP resends and truncations, and the check result, answers sent, verified and failed.