From 102d45988b380a9e925ca2688c77920c4a54e169 Mon Sep 17 00:00:00 2001 From: Benedikt Trefzer Date: Thu, 29 Oct 2020 14:03:45 +0100 Subject: [PATCH 1/4] add maxrequestworkers parameter for mpm_worker module --- manifests/mod/worker.pp | 1 + templates/mod/worker.conf.erb | 3 +++ 2 files changed, 4 insertions(+) diff --git a/manifests/mod/worker.pp b/manifests/mod/worker.pp index 2b1ca24fe4..139ee354eb 100644 --- a/manifests/mod/worker.pp +++ b/manifests/mod/worker.pp @@ -53,6 +53,7 @@ Integer $threadlimit = 64, Integer $listenbacklog = 511, Optional[String] $apache_version = undef, + Optional[Integer] $maxrequestworkers = undef, ) { include apache $_apache_version = pick($apache_version, $apache::apache_version) diff --git a/templates/mod/worker.conf.erb b/templates/mod/worker.conf.erb index 8ad6451c75..5158a1b050 100644 --- a/templates/mod/worker.conf.erb +++ b/templates/mod/worker.conf.erb @@ -8,4 +8,7 @@ ThreadsPerChild <%= @threadsperchild %> MaxRequestsPerChild <%= @maxrequestsperchild %> ListenBacklog <%= @listenbacklog %> + <%- if @maxrequestworkers -%> + MaxRequestWorkers <%= @maxrequestworkers %> + <%- end -%> From a6a70b471a6ea3fd36bbb97d7241c5ac1a2c5850 Mon Sep 17 00:00:00 2001 From: Benedikt Trefzer Date: Sun, 30 Oct 2022 13:21:09 +0100 Subject: [PATCH 2/4] add logic to ignore maxclients if maxrequestworkers is set --- manifests/mod/worker.pp | 5 +++++ templates/mod/worker.conf.erb | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/manifests/mod/worker.pp b/manifests/mod/worker.pp index 139ee354eb..669beb257e 100644 --- a/manifests/mod/worker.pp +++ b/manifests/mod/worker.pp @@ -8,6 +8,7 @@ # The max number of simultaneous requests that will be served. # This is the old name and is still supported. The new name is # MaxRequestWorkers as of 2.3.13. +# If maxreuestworkers is set, this value is ignored. # # @param minsparethreads # Minimum number of idle threads to handle request spikes. @@ -40,6 +41,10 @@ # @param apache_version # Used to verify that the Apache version you have requested is compatible with the module. # +# @param maxrequestworkers +# Maximum number of connections that will be processed simultaneously +# if set, maxclients is ignored +# # @see https://httpd.apache.org/docs/current/mod/worker.html for additional documentation. # class apache::mod::worker ( diff --git a/templates/mod/worker.conf.erb b/templates/mod/worker.conf.erb index 5158a1b050..cc8912ac25 100644 --- a/templates/mod/worker.conf.erb +++ b/templates/mod/worker.conf.erb @@ -2,13 +2,14 @@ ServerLimit <%= @serverlimit %> StartServers <%= @startservers %> ThreadLimit <%= @threadlimit %> - MaxClients <%= @maxclients %> MinSpareThreads <%= @minsparethreads %> MaxSpareThreads <%= @maxsparethreads %> ThreadsPerChild <%= @threadsperchild %> MaxRequestsPerChild <%= @maxrequestsperchild %> ListenBacklog <%= @listenbacklog %> <%- if @maxrequestworkers -%> - MaxRequestWorkers <%= @maxrequestworkers %> + MaxRequestWorkers <%= @maxrequestworkers %> + <%- elsif @maxclients -%> + MaxClients <%= @maxclients %> <%- end -%> From 246617ff582d6b514ab76b5fb59256649ec9d00a Mon Sep 17 00:00:00 2001 From: Benedikt Trefzer Date: Mon, 7 Nov 2022 13:39:57 +0100 Subject: [PATCH 3/4] add spec test for MaxRequestWorkers --- spec/classes/mod/worker_spec.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spec/classes/mod/worker_spec.rb b/spec/classes/mod/worker_spec.rb index aaed242378..5fafac88ac 100644 --- a/spec/classes/mod/worker_spec.rb +++ b/spec/classes/mod/worker_spec.rb @@ -113,7 +113,7 @@ { serverlimit: 10, startservers: 11, - maxclients: 12, + maxrequestworkers: 12, minsparethreads: 13, maxsparethreads: 14, threadsperchild: 15, @@ -126,7 +126,8 @@ it { is_expected.to contain_file('/etc/httpd/conf.modules.d/worker.conf').with(content: %r{^$}) } it { is_expected.to contain_file('/etc/httpd/conf.modules.d/worker.conf').with(content: %r{^\s+ServerLimit\s+10$}) } it { is_expected.to contain_file('/etc/httpd/conf.modules.d/worker.conf').with(content: %r{^\s+StartServers\s+11$}) } - it { is_expected.to contain_file('/etc/httpd/conf.modules.d/worker.conf').with(content: %r{^\s+MaxClients\s+12$}) } + it { is_expected.to contain_file('/etc/httpd/conf.modules.d/worker.conf').without(content: %r{^\s+MaxClients}) } + it { is_expected.to contain_file('/etc/httpd/conf.modules.d/worker.conf').with(content: %r{^\s+MaxRequestWorkers\s+12$}) } it { is_expected.to contain_file('/etc/httpd/conf.modules.d/worker.conf').with(content: %r{^\s+MinSpareThreads\s+13$}) } it { is_expected.to contain_file('/etc/httpd/conf.modules.d/worker.conf').with(content: %r{^\s+MaxSpareThreads\s+14$}) } it { is_expected.to contain_file('/etc/httpd/conf.modules.d/worker.conf').with(content: %r{^\s+ThreadsPerChild\s+15$}) } From 58e3a351b0b6ccc62ee03d46977c70239d7df22b Mon Sep 17 00:00:00 2001 From: Benedikt Trefzer Date: Mon, 7 Nov 2022 14:48:10 +0100 Subject: [PATCH 4/4] fix typo --- manifests/mod/worker.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/mod/worker.pp b/manifests/mod/worker.pp index 669beb257e..652f9606d0 100644 --- a/manifests/mod/worker.pp +++ b/manifests/mod/worker.pp @@ -8,7 +8,7 @@ # The max number of simultaneous requests that will be served. # This is the old name and is still supported. The new name is # MaxRequestWorkers as of 2.3.13. -# If maxreuestworkers is set, this value is ignored. +# If maxrequestworkers is set, this value is ignored. # # @param minsparethreads # Minimum number of idle threads to handle request spikes.