Skip to content
Contents
GuidesOpenWrt

Why DNS caching does not speed up every first visit

First, check on the client side which local resolver is actually being used.

First, check on the client side which local resolver is actually being used. If a domain name query becomes faster on the second attempt, it usually indicates caching is in effect. Clearly distinguish among three behaviors: responses from cache, early refreshes just before cache expiration, and temporary provision of old answers when upstream connectivity fails.

Test the three request types separately

Perform cold cache, hot cache, and near-expiration (close to TTL expiry) queries using the test domain. Record query times with dig @<DNS地址> <测试域> A +stats and TTL. Check parser support for prefetch and serve-expired configurations. For internal services with frequently changing addresses, set a shorter expiration limit for stale responses.

Enable the prefetch setting in the isolated SmartDNS instance and verify the configuration and a local answer.
Enable the prefetch setting in the isolated SmartDNS instance and verify the configuration and a local answer. · OpenWrt 25.12.6 x86/64 (SSH, QEMU/KVM)
Enable the prefetch setting in the isolated SmartDNS instance and verify the configuration and a local answer. · OpenWrt 25.12.6 x86/64 (SSH, QEMU/KVM) Open the original image

Cold cache, hot cache, and connection establishment comparison

From the same client using the same DNS resolver, query the controlled target, recording the response at first query, repeated query, and after TTL expiration. Then perform a connection test to the actual site.

Temporarily disable the upstream in a controlled environment and check two domains: one that's already cached and one that hasn't been queried before. After restoring the upstream, observe the refresh results. The recorded value is the local round-trip time; page loading also includes connection establishment, TLS handshake, and server response.

DNS cache optimization only handles the DNS resolution phase. If business performance remains slow, proceed to inspect TLS, server response, and queuing issues; if failures occur, revert to the original cache configuration.

Reference

Related guides

Reference

Check the model, region and hardware revision on the label before selecting firmware.

Explore hardware

Comments