bundles/unbound: better caching

This commit is contained in:
Franzi 2020-12-22 09:22:37 +01:00
parent 5935aed0db
commit 5e45efb7ae
Signed by: kunsi
GPG key ID: 12E3D2136B818350
2 changed files with 11 additions and 2 deletions

View file

@ -27,7 +27,12 @@ server:
access-control: ::1 allow
% endif
msg-cache-size: ${cache_size}
msg-cache-slabs: ${cache_slabs}
rrset-cache-size: ${cache_size}
rrset-cache-slabs: ${cache_slabs}
cache-max-ttl: ${max_ttl}
cache-max-negative-ttl: 600
use-syslog: yes
log-queries: no

View file

@ -17,15 +17,19 @@ defaults = {
},
'unbound': {
'max_ttl': 3600,
'cache_size': '512M',
},
}
@metadata_reactor
def cpu_cores_to_threads(metadata):
def cpu_cores_to_config_values(metadata):
num_cpus = metadata.get('vm/cpu', 1)
return {
'unbound': {
'threads': metadata.get('vm/cpu', 1)*2,
'threads': num_cpus*2,
'cache_slabs': 2**(num_cpus-1).bit_length(),
},
}