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