diff --git a/manifests/mod/worker.pp b/manifests/mod/worker.pp index 2b1ca24fe4..652f9606d0 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 maxrequestworkers 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 ( @@ -53,6 +58,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/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$}) } diff --git a/templates/mod/worker.conf.erb b/templates/mod/worker.conf.erb index 8ad6451c75..cc8912ac25 100644 --- a/templates/mod/worker.conf.erb +++ b/templates/mod/worker.conf.erb @@ -2,10 +2,14 @@ ServerLimit <%= @serverlimit %> StartServers <%= @startservers %> ThreadLimit <%= @threadlimit %> - MaxClients <%= @maxclients %> MinSpareThreads <%= @minsparethreads %> MaxSpareThreads <%= @maxsparethreads %> ThreadsPerChild <%= @threadsperchild %> MaxRequestsPerChild <%= @maxrequestsperchild %> ListenBacklog <%= @listenbacklog %> + <%- if @maxrequestworkers -%> + MaxRequestWorkers <%= @maxrequestworkers %> + <%- elsif @maxclients -%> + MaxClients <%= @maxclients %> + <%- end -%>