DNS resolution timer

← simple version · every parameter exposed

Measures how long a hostname takes to resolve, using only JavaScript — by deliberately blocking Chrome’s host-resolver job queue so the lookup under test runs alone between two markers.

How it works

  1. Fill the queue. Chrome dispatches at most 64 resolver jobs at a time (kDefaultMaxSystemTasks). We start nfill = 63 requests to hold<ms>-….<zone>, names whose authoritative server answers only after hold ms. After ~2.6 s all 63 jobs occupy slots and the queue is saturated, with exactly one slot left.
  2. Start marker. https://t0-<id>.invalid:0/ — port 0 is rejected in HttpStreamFactory::Job::DoStart() before a resolver job exists, so it costs no slot and no DNS query but still gives us a timestamp.
  3. Target. The URL under test grabs the single free slot. Its lookup therefore cannot be interleaved with anything else in the job queue.
  4. Stop markers. After a ~0.6 ms busy-wait (so the target’s job is created first), three own-zone names m1..m3-<id>.<zone>:<dead-port> are queued with priority: 'low'. They cannot run until the target’s job finishes and frees its slot, so m1 settles a fixed instrument cost after the target’s answer.
  5. Self-calibration. The stop markers resolve for real (they answer an A/AAAA record and then fail to connect on the dead port, so Chrome does not retry), which means each one costs one resolver job of its own: d1 = m1−m0 is target + one marker, d2 = m2−m1 and d3 = m3−m2 are one marker. Hence dns = d1 − (d2+d3)/2: the marker’s cost and Chrome’s completion pipeline cancel out of the answer.
  6. All fillers are awaited before the next measurement, so no job leaks into the next bracket.

Expected accuracy (validated against tcpdump on Chrome 156 / Linux): σ ≈ 2 ms single shot, ≈ 1 ms for the median of several reps. Repeating the same hostname is only meaningful with a fresh name (Chrome’s host cache lasts ~60 s), which is what the {id} placeholder is for.

Zone
URL templates

{id} random token, {i} filler index, {k} marker number, {zone}, {hold}, {mport}. The filler name must make your authoritative server delay its answer by hold ms; the marker name must resolve successfully (so Chrome does not retry it) to an address where mport is closed (so the connection fails immediately).




Targets

One URL per line. {id} is replaced with a random token, which both guarantees a cold host-cache entry and lets you repeat a measurement immediately (e.g. https://d0-{id}.l.hamshukim.homes/). Without {id} a name can only be measured once per ~60 s; repeats are then spaced out automatically.

targetrepdns msd1markerd2d3 fillersverdict

Log