From 75c98d0f0743b4582ef62935b380cacbf252e7e0 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Sun, 15 Sep 2019 09:47:05 +0200 Subject: [PATCH 1/1] Make apache worker config not depend on role memberships --- hieradata/nodes/beach.debian.org.yaml | 2 ++ hieradata/nodes/buxtehude.debian.org.yaml | 2 ++ hieradata/nodes/pinel.debian.org.yaml | 2 ++ modules/apache2/manifests/init.pp | 8 +++++++- modules/apache2/templates/mpm_worker.erb | 4 +--- 5 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 hieradata/nodes/buxtehude.debian.org.yaml create mode 100644 hieradata/nodes/pinel.debian.org.yaml diff --git a/hieradata/nodes/beach.debian.org.yaml b/hieradata/nodes/beach.debian.org.yaml index a202ad6de..770daa1c6 100644 --- a/hieradata/nodes/beach.debian.org.yaml +++ b/hieradata/nodes/beach.debian.org.yaml @@ -1,3 +1,5 @@ --- classes: - bugs_mirror + +apache2::smaller_number_of_threads: true diff --git a/hieradata/nodes/buxtehude.debian.org.yaml b/hieradata/nodes/buxtehude.debian.org.yaml new file mode 100644 index 000000000..212974c57 --- /dev/null +++ b/hieradata/nodes/buxtehude.debian.org.yaml @@ -0,0 +1,2 @@ +--- +apache2::smaller_number_of_threads: true diff --git a/hieradata/nodes/pinel.debian.org.yaml b/hieradata/nodes/pinel.debian.org.yaml new file mode 100644 index 000000000..212974c57 --- /dev/null +++ b/hieradata/nodes/pinel.debian.org.yaml @@ -0,0 +1,2 @@ +--- +apache2::smaller_number_of_threads: true diff --git a/modules/apache2/manifests/init.pp b/modules/apache2/manifests/init.pp index 7875bd717..dfa4b59bc 100644 --- a/modules/apache2/manifests/init.pp +++ b/modules/apache2/manifests/init.pp @@ -6,7 +6,13 @@ # # include apache2 # -class apache2 { +# @param smaller_number_of_threads by default the worker config is geared towards +# serving static/cheap content. If the host is very +# script heavy (say the bug tracking system), set this +# to reduce the number of worker threads. +class apache2( + Boolean $smaller_number_of_threads = false +) { include webserver package { 'apache2': diff --git a/modules/apache2/templates/mpm_worker.erb b/modules/apache2/templates/mpm_worker.erb index 952599841..c433bb916 100644 --- a/modules/apache2/templates/mpm_worker.erb +++ b/modules/apache2/templates/mpm_worker.erb @@ -23,9 +23,7 @@ # MaxConnectionsPerChild 0 -<% if scope.function_has_role(['bugs_base']) or - scope.function_has_role(['popcon']) - -%> +<% if @smaller_number_of_threads -%> StartServers 2 MinSpareThreads 25 MaxSpareThreads 75 -- 2.20.1