From 231fe0103a296a7d7a25bb2757f1cc906015807a Mon Sep 17 00:00:00 2001 From: Timo Makinen Date: Sat, 18 Jan 2025 18:47:04 +0000 Subject: [PATCH] unbound: Optimize CPU core usage --- .../unbound/templates/unbound.conf.dna-gw01.home.foo.sh.j2 | 7 +++++++ .../unbound/templates/unbound.conf.dna-gw02.home.foo.sh.j2 | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/roles/unbound/templates/unbound.conf.dna-gw01.home.foo.sh.j2 b/roles/unbound/templates/unbound.conf.dna-gw01.home.foo.sh.j2 index 1479483..9cd96f8 100644 --- a/roles/unbound/templates/unbound.conf.dna-gw01.home.foo.sh.j2 +++ b/roles/unbound/templates/unbound.conf.dna-gw01.home.foo.sh.j2 @@ -1,4 +1,11 @@ server: + # https://nlnetlabs.nl/documentation/unbound/howto-optimise/ + num-threads: {{ ansible_processor_cores }} + msg-cache-slabs: {{ ansible_processor_cores | int | pow(2) | int }} + rrset-cache-slabs: {{ ansible_processor_cores | int | pow(2) | int }} + infra-cache-slabs: {{ ansible_processor_cores | int | pow(2) | int }} + key-cache-slabs: {{ ansible_processor_cores | int | pow(2) | int }} + interface: 172.20.20.10@53 interface: 172.20.20.10@853 interface: 172.20.21.1@53 diff --git a/roles/unbound/templates/unbound.conf.dna-gw02.home.foo.sh.j2 b/roles/unbound/templates/unbound.conf.dna-gw02.home.foo.sh.j2 index c2f67ef..de8a3d4 100644 --- a/roles/unbound/templates/unbound.conf.dna-gw02.home.foo.sh.j2 +++ b/roles/unbound/templates/unbound.conf.dna-gw02.home.foo.sh.j2 @@ -1,4 +1,11 @@ server: + # https://nlnetlabs.nl/documentation/unbound/howto-optimise/ + num-threads: {{ ansible_processor_cores }} + msg-cache-slabs: {{ ansible_processor_cores | int | pow(2) | int }} + rrset-cache-slabs: {{ ansible_processor_cores | int | pow(2) | int }} + infra-cache-slabs: {{ ansible_processor_cores | int | pow(2) | int }} + key-cache-slabs: {{ ansible_processor_cores | int | pow(2) | int }} + interface: 172.20.20.10@53 interface: 172.20.20.10@853 interface: 172.20.21.2@53