HIRO GEAR
インフラ DNS AdGuard

Record: Accelerating Home LAN DNS Resolution by 80x via AdGuard Home Concurrent Request Optimization

Record: Accelerating Home LAN DNS Resolution by 80x via AdGuard Home Concurrent Request Optimization

I have a fiber internet connection, and physical pings to my router or the internet are extremely good at around 5ms. However, I was bothered by the phenomenon where “the browser hangs for about a second when opening a site visited for the first time.”

Investigating further revealed an unexpected pitfall in the settings of AdGuard Home, which serves as both my ad blocker and DNS cache server at home.

The Real Bottleneck: The fastest_addr Trap

AdGuard Home offers several modes for upstream DNS queries. One of them is fastest_addr (Fastest IP Selection).

“It seems like a win-win to pick the fastest IP,” one might think, but this was actually the root cause.

  • Behavior of fastest_addr: For every IP address returned by name resolution, AdGuard itself sequentially sends ping or TCP connection tests to select the fastest IP and return it to the client.
  • The Problem: Servers that do not respond to pings or overseas hosts cause the response to the client to be completely blocked until the timeout (default 1 second) is reached.

In actual measurements, queries to uncached domains took as much as 1,020ms (over 1 second).

Solution: parallel (Parallel Requests) and Optimistic Caching

I completely overhauled the settings as follows:

  1. Changed the query mode to parallel: Sends queries simultaneously to multiple upstream DNS servers (Cloudflare, Google, Quad9) and immediately adopts the first response received.
  2. Added Cloudflare DoH with the fastest domestic location as an upstream: Placed https://cloudflare-dns.com/dns-query at the top of the list.
  3. Enabled cache_optimistic: true (Optimistic Caching): Even if a record’s TTL has expired, it immediately returns the previous cache with 0ms latency while updating asynchronously in the background.

[!TIP] By setting the minimum TTL (cache_ttl_min) to 300 seconds (5 minutes), you can prevent frequent queries caused by short expiration times like “30 seconds,” which are common with recent CDNs.

Results: From 1,020ms to 10ms

After applying the settings, query times for uncached domains dramatically improved to 10ms–15ms (an approximately 80x speedup).

Not only does daily web browsing feel smoother, but the responsiveness of git clone and npm install in the terminal has also significantly improved, greatly enhancing network transparency.