Unbound - domains cached only for short time

Solution 1:

Unbound will (or at least should) be caching the result for the time specified in the TTL for the record you are requesting.

This is exactly what I observe on a system I have to hand that is running unbound. The initial request takes 14ms, subsequent requests take 0ms and when the TTL expires the next request takes 14ms.

Initial request which shows a 300 second TTL and takes 18ms

;; ANSWER SECTION:
google.com.             300     IN      A       172.217.20.46

;; Query time: 18 msec
;; SERVER: 10.34.20.1#53(10.34.20.1)
;; WHEN: Sun Feb 12 20:39:30 2017
;; MSG SIZE  rcvd: 44

Subsequent requests - TTL is counting down and takes 0ms

;; ANSWER SECTION:
google.com.             196     IN      A       172.217.20.46

;; Query time: 0 msec
;; SERVER: 10.34.20.1#53(10.34.20.1)
;; WHEN: Sun Feb 12 20:41:14 2017
;; MSG SIZE  rcvd: 44

TTL expired so another upstream request is made 23ms

;; ANSWER SECTION:
google.com.             300     IN      A       172.217.20.46

;; Query time: 23 msec
;; SERVER: 10.34.20.1#53(10.34.20.1)
;; WHEN: Sun Feb 12 20:44:37 2017
;; MSG SIZE  rcvd: 44