From 4f08e78d87870b028194c504a59978c99af5510b Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Wed, 17 Jul 2019 12:37:43 +0200 Subject: [PATCH] Unbound: add more cusomisable fields to the server template. --- library/roles/unbound-resolver/defaults/main.yml | 11 +++++++++++ .../templates/unbound-server.conf | 16 ++++++++-------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/library/roles/unbound-resolver/defaults/main.yml b/library/roles/unbound-resolver/defaults/main.yml index ab3782f0..20bb1a94 100644 --- a/library/roles/unbound-resolver/defaults/main.yml +++ b/library/roles/unbound-resolver/defaults/main.yml @@ -18,3 +18,14 @@ unbound_threads: '{{ ansible_processor_count }}' unbound_remote_control: 'yes' unbound_remote_IP: '127.0.0.1' + +unbound_rrset_cache_size: 100m +unbound_rrset_msg_cache_size: 50m +# Larger socket buffer. OS may need config. +unbound_so_rcvbuf: 4m +unbound_so_sndbuf: 4m +# Faster UDP with multithreading (only on Linux). +unbound_so_reuseport: 'yes' +# with libevent +unbound_outgoing_range: 8192 +unbound_num_queries_per_thread: 4096 diff --git a/library/roles/unbound-resolver/templates/unbound-server.conf b/library/roles/unbound-resolver/templates/unbound-server.conf index 07f09e3e..e955d899 100644 --- a/library/roles/unbound-resolver/templates/unbound-server.conf +++ b/library/roles/unbound-resolver/templates/unbound-server.conf @@ -21,22 +21,22 @@ server: key-cache-slabs: {{ unbound_threads }} # more cache memory, rrset=msg*2 - rrset-cache-size: 100m - msg-cache-size: 50m + rrset-cache-size: {{ unbound_rrset_cache_size }} + msg-cache-size: {{ unbound_rrset_msg_cache_size }} # more outgoing connections # depends on number of cores: 1024/cores - 50 - outgoing-range: {{ 1024 / unbound_threads - 50 }} + outgoing-range: {{ 1024 // unbound_threads - 50 }} # Larger socket buffer. OS may need config. - so-rcvbuf: 4m - so-sndbuf: 4m + so-rcvbuf: {{ unbound_so_rcvbuf }} + so-sndbuf: {{ unbound_so_sndbuf }} # Faster UDP with multithreading (only on Linux). - so-reuseport: yes + so-reuseport: {{ unbound_so_reuseport }} # with libevent - outgoing-range: 8192 - num-queries-per-thread: 4096 + outgoing-range: {{ unbound_outgoing_range }} + num-queries-per-thread: {{ unbound_num_queries_per_thread }} {% if ansible_service_mgr == 'systemd' %} use-systemd: yes do-daemonize: no