How to measure cache hit resolution time in unbound 1.24.1
Seth Van Buren
seth.vanburen at versent.com.au
Wed Nov 26 12:37:05 UTC 2025
I think you missed the point. See: https://nlnetlabs.nl/documentation/unbound/howto-optimise/
Set
*-slabs
to a power of 2 close to the
num-threads
value. Do this for
msg-cache-slabs
,
rrset-cache-slabs
,
infra-cache-slabs
and
key-cache-slabs
. This reduces lock contention.
I service several hundred thousands of simultaneous clients with 10,000s queries per second on only 12 threads. Cache response time is less than 1ms, average response time is < 10ms. My hosts (I have 3 of them) have 16 threads/cores each, I leave 4 threads to do some server busy work like stats and logs collection. More threads doesn’t always mean better performance and in your case since your slab count is low you’re going to have a lot of lock contention.
Cheers
From: sir izake <sirizake at gmail.com>
Date: Wednesday, 26 November 2025 at 7:35 pm
To: Seth Van Buren <seth.vanburen at versent.com.au>
Cc: unbound-users at lists.nlnetlabs.nl <unbound-users at lists.nlnetlabs.nl>
Subject: Re: How to measure cache hit resolution time in unbound 1.24.1
Hi Seth
The server is dedicated for this purpose hence the high number of threads
below configs are in place:
num-queries-per-thread: 4096
msg-cache-size: 10G
rrset-cache-size: 20G
key-cache-size: 1G
Thank you
On Wed, Nov 26, 2025 at 3:34 AM Seth Van Buren <seth.vanburen at versent.com.au<mailto:seth.vanburen at versent.com.au>> wrote:
Your thread should be equal to or lower than the number of slabs.
The thread count seems extremely high, you should not need so many. You should set num-queries-per-thread. Try 16384
Can you also paste your memory settings and Cache settings?
From: sir izake <sirizake at gmail.com<mailto:sirizake at gmail.com>>
Date: Tuesday, 25 November 2025 at 8:08 pm
To: Seth Van Buren <seth.vanburen at versent.com.au<mailto:seth.vanburen at versent.com.au>>
Cc: unbound-users at lists.nlnetlabs.nl<mailto:unbound-users at lists.nlnetlabs.nl> <unbound-users at lists.nlnetlabs.nl<mailto:unbound-users at lists.nlnetlabs.nl>>
Subject: Re: How to measure cache hit resolution time in unbound 1.24.1
Hi Seth
num-threads: 64
msg-cache-slabs: 32
rrset-cache-slabs: 32
infra-cache-slabs: 32
key-cache-slabs: 32
ratelimit-slabs: 32
ip-ratelimit-slabs: 32
The physical server is a dell 640 with specs below
hw.ncpu: 104
hw.model: Intel(R) Xeon(R) Gold 6230R CPU @ 2.10GHz
Thank you
Isaac
On Tue, Nov 25, 2025 at 5:13 AM Seth Van Buren <seth.vanburen at versent.com.au<mailto:seth.vanburen at versent.com.au>> wrote:
Home many cores/slabs are you using?
From: Unbound-users <unbound-users-bounces at lists.nlnetlabs.nl<mailto:unbound-users-bounces at lists.nlnetlabs.nl>> on behalf of sir izake via Unbound-users <unbound-users at lists.nlnetlabs.nl<mailto:unbound-users at lists.nlnetlabs.nl>>
Date: Tuesday, 25 November 2025 at 2:51 pm
To: unbound-users at lists.nlnetlabs.nl<mailto:unbound-users at lists.nlnetlabs.nl> <unbound-users at lists.nlnetlabs.nl<mailto:unbound-users at lists.nlnetlabs.nl>>
Subject: How to measure cache hit resolution time in unbound 1.24.1
Hi
I have installed unbound 1.24.1 on FreeBSD 14.3 OS. My cache hit rate is 76% with over 20% coming through recursive replies.
The median time for recursive replies is 440ms while the avg is 520ms.
This setup has been running for over 72hrs. I expect stats to improve but that is not happening.
Just wanted to find out if there is a way to measure the cache hit resolution time in a dashboard?
Can I do anything to improve cache hit ratio?
Can I also improve the recursive reply time?
I am using unbound_exporter to monitor stats in grafana
My configs have been adjusted as follows:
rrset-cache-size: 20G
msg-cache-size: 10G
cache-min-ttl: 1800
I am using the root hint files directly on the server for recursive lookup and not forwarding to any public resolver
Thank you
Regards,
Isaac
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nlnetlabs.nl/pipermail/unbound-users/attachments/20251126/968728d3/attachment-0001.htm>
More information about the Unbound-users
mailing list