From b251f1393f8abc47f2d4a7c30f62f02484033cda Mon Sep 17 00:00:00 2001 From: Colleen Murphy Date: Wed, 15 Mar 2017 15:39:35 +0100 Subject: [PATCH] Tweak mpm_worker settings This patch allows puppet to handle configuration of the mpm_worker apache mod. The config file added here is copied from an Ubuntu Trusty apache package with the value of MaxRequestWorkers changed from 150 to 400. I reason that this is a reasonable number based on the MaxRequestWorkers documentation claiming the default is 400 for mpm_worker[1]: For threaded and hybrid servers (e.g. event or worker) MaxRequestWorkers restricts the total number of threads that will be available to serve clients. For hybrid MPMs the default value is 16 (ServerLimit) multiplied by the value of 25 (ThreadsPerChild). Therefore, to increase MaxRequestWorkers to a value that requires more than 16 processes, you must also raise ServerLimit. If 400 is too few, we can increase it but we must also increase ServerLimit, which requires not just an apache restart but a full stop and start[2]: Any attempts to change this directive during a restart will be ignored [1] https://httpd.apache.org/docs/2.4/mod/mpm_common.html#maxrequestworkers [2] https://httpd.apache.org/docs/2.4/mod/mpm_common.html#serverlimit Change-Id: Iab0012e02506f5b7212fe273cfe673f95279d440 --- .../files/files/mpm_worker.conf | 23 +++++++++++++++++++ modules/openstack_project/manifests/files.pp | 6 +++++ 2 files changed, 29 insertions(+) create mode 100644 modules/openstack_project/files/files/mpm_worker.conf diff --git a/modules/openstack_project/files/files/mpm_worker.conf b/modules/openstack_project/files/files/mpm_worker.conf new file mode 100644 index 0000000000..a4fb1b3b8d --- /dev/null +++ b/modules/openstack_project/files/files/mpm_worker.conf @@ -0,0 +1,23 @@ +# Managed by puppet +# worker MPM +# StartServers: initial number of server processes to start +# MinSpareThreads: minimum number of worker threads which are kept spare +# MaxSpareThreads: maximum number of worker threads which are kept spare +# ThreadLimit: ThreadsPerChild can be changed to this maximum value during a +# graceful restart. ThreadLimit can only be changed by stopping +# and starting Apache. +# ThreadsPerChild: constant number of worker threads in each server process +# MaxRequestWorkers: maximum number of threads +# MaxConnectionsPerChild: maximum number of requests a server process serves + + + StartServers 2 + MinSpareThreads 25 + MaxSpareThreads 75 + ThreadLimit 64 + ThreadsPerChild 25 + MaxRequestWorkers 400 + MaxConnectionsPerChild 0 + + +# vim: syntax=apache ts=4 sw=4 sts=4 sr noet diff --git a/modules/openstack_project/manifests/files.pp b/modules/openstack_project/manifests/files.pp index 23dfc05291..f24dfe4248 100644 --- a/modules/openstack_project/manifests/files.pp +++ b/modules/openstack_project/manifests/files.pp @@ -91,6 +91,12 @@ class openstack_project::files ( httpd::mod { 'mpm_event': ensure => 'absent' } httpd::mod { 'mpm_worker': ensure => 'present' } + file { '/etc/apache2/mods-available/mpm_worker.conf': + ensure => file, + source => 'puppet:///modules/openstack_project/files/mpm_worker.conf', + notify => Service['httpd'], + } + ########################################################### # docs.openstack.org