]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
unbound: Launch more threads
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 28 Nov 2025 12:23:08 +0000 (12:23 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 3 Dec 2025 10:25:28 +0000 (10:25 +0000)
This partially reverts 0f0f3ae7dc5da502c1aaf4bb295778d7657a0af5 which
attempted to remove lock contention. However, we are still observing
that Unbound sometimes just seems to hang. This should create multiple
independent threads which could compensate if one of the threads locks
up and is in line with upstream configuration.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/initscripts/system/unbound

index 56f7f4ff02a0547f9940142dd46127e64c1c4bd8..c6b3821ac96d86e42fa5b5138f937ec04d4813b9 100644 (file)
@@ -217,6 +217,9 @@ write_forward_conf() {
 write_tuning_conf() {
        # https://www.unbound.net/documentation/howto_optimise.html
 
+       # Determine number of online processors
+       local processors=$(getconf _NPROCESSORS_ONLN)
+
        # Determine amount of system memory
        local mem=$(get_memory_amount)
 
@@ -251,6 +254,10 @@ write_tuning_conf() {
        (
                config_header
 
+               # We run one thread per processor
+               echo "num-threads: ${processors}"
+               echo "so-reuseport: yes"
+
                # Slice up the cache
                echo "rrset-cache-size: $(( ${mem} / 2 ))m"
                echo "msg-cache-size: $(( ${mem} / 4 ))m"