aboutsummaryrefslogtreecommitdiffstats
path: root/config/unbound
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2010-12-15 18:48:54 -0500
committerScott Ullrich <sullrich@pfsense.org>2010-12-15 18:49:05 -0500
commitb1f8ea5fdc52de3f456ccdc8ac50645ce1387604 (patch)
tree15d808a3796694d199bcb9480187e6431704035e /config/unbound
parent24f949a4bf10029d7397a22da76dacad61dbac66 (diff)
downloadpfsense-packages-b1f8ea5fdc52de3f456ccdc8ac50645ce1387604.tar.gz
pfsense-packages-b1f8ea5fdc52de3f456ccdc8ac50645ce1387604.tar.bz2
pfsense-packages-b1f8ea5fdc52de3f456ccdc8ac50645ce1387604.zip
Set number of operating threads equal to number of cpu/cores
Diffstat (limited to 'config/unbound')
-rw-r--r--config/unbound/unbound.inc11
1 files changed, 10 insertions, 1 deletions
diff --git a/config/unbound/unbound.inc b/config/unbound/unbound.inc
index 4e311e0f..bc29cfff 100644
--- a/config/unbound/unbound.inc
+++ b/config/unbound/unbound.inc
@@ -293,7 +293,15 @@ function unbound_resync_config() {
$cumulative_stats = "no";
$extended_stats = "no";
}
-
+
+ // Set the number of threads equal to number of CPUs.
+ // Use 1 if for some reason this sysctl fails.
+ $numprocs = intval(trim(`/sbin/sysctl kern.smp.cpus | /usr/bin/cut -d" " -f2`));
+ if($numprocs > 0)
+ $number_threads = "num-threads: {$numprocs}";
+ else
+ $number_threads = "num-threads: 1";
+
$unbound_conf = <<<EOD
#########################
# Unbound configuration #
@@ -303,6 +311,7 @@ function unbound_resync_config() {
# Server config
###
server:
+{$number_threads}
verbosity: 1
port: 53
do-ip4: yes