Skip to content

Commit 0cb1c07

Browse files
authored
Merge pull request #2331 from cirrax/fix_maxrequestworkers
add maxrequestworkers parameter for mpm_worker module
2 parents 15c8686 + 58e3a35 commit 0cb1c07

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

manifests/mod/worker.pp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
# The max number of simultaneous requests that will be served.
99
# This is the old name and is still supported. The new name is
1010
# MaxRequestWorkers as of 2.3.13.
11+
# If maxrequestworkers is set, this value is ignored.
1112
#
1213
# @param minsparethreads
1314
# Minimum number of idle threads to handle request spikes.
@@ -40,6 +41,10 @@
4041
# @param apache_version
4142
# Used to verify that the Apache version you have requested is compatible with the module.
4243
#
44+
# @param maxrequestworkers
45+
# Maximum number of connections that will be processed simultaneously
46+
# if set, maxclients is ignored
47+
#
4348
# @see https://httpd.apache.org/docs/current/mod/worker.html for additional documentation.
4449
#
4550
class apache::mod::worker (
@@ -53,6 +58,7 @@
5358
Integer $threadlimit = 64,
5459
Integer $listenbacklog = 511,
5560
Optional[String] $apache_version = undef,
61+
Optional[Integer] $maxrequestworkers = undef,
5662
) {
5763
include apache
5864
$_apache_version = pick($apache_version, $apache::apache_version)

spec/classes/mod/worker_spec.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
{
114114
serverlimit: 10,
115115
startservers: 11,
116-
maxclients: 12,
116+
maxrequestworkers: 12,
117117
minsparethreads: 13,
118118
maxsparethreads: 14,
119119
threadsperchild: 15,
@@ -126,7 +126,8 @@
126126
it { is_expected.to contain_file('/etc/httpd/conf.modules.d/worker.conf').with(content: %r{^<IfModule mpm_worker_module>$}) }
127127
it { is_expected.to contain_file('/etc/httpd/conf.modules.d/worker.conf').with(content: %r{^\s+ServerLimit\s+10$}) }
128128
it { is_expected.to contain_file('/etc/httpd/conf.modules.d/worker.conf').with(content: %r{^\s+StartServers\s+11$}) }
129-
it { is_expected.to contain_file('/etc/httpd/conf.modules.d/worker.conf').with(content: %r{^\s+MaxClients\s+12$}) }
129+
it { is_expected.to contain_file('/etc/httpd/conf.modules.d/worker.conf').without(content: %r{^\s+MaxClients}) }
130+
it { is_expected.to contain_file('/etc/httpd/conf.modules.d/worker.conf').with(content: %r{^\s+MaxRequestWorkers\s+12$}) }
130131
it { is_expected.to contain_file('/etc/httpd/conf.modules.d/worker.conf').with(content: %r{^\s+MinSpareThreads\s+13$}) }
131132
it { is_expected.to contain_file('/etc/httpd/conf.modules.d/worker.conf').with(content: %r{^\s+MaxSpareThreads\s+14$}) }
132133
it { is_expected.to contain_file('/etc/httpd/conf.modules.d/worker.conf').with(content: %r{^\s+ThreadsPerChild\s+15$}) }

templates/mod/worker.conf.erb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@
22
ServerLimit <%= @serverlimit %>
33
StartServers <%= @startservers %>
44
ThreadLimit <%= @threadlimit %>
5-
MaxClients <%= @maxclients %>
65
MinSpareThreads <%= @minsparethreads %>
76
MaxSpareThreads <%= @maxsparethreads %>
87
ThreadsPerChild <%= @threadsperchild %>
98
MaxRequestsPerChild <%= @maxrequestsperchild %>
109
ListenBacklog <%= @listenbacklog %>
10+
<%- if @maxrequestworkers -%>
11+
MaxRequestWorkers <%= @maxrequestworkers %>
12+
<%- elsif @maxclients -%>
13+
MaxClients <%= @maxclients %>
14+
<%- end -%>
1115
</IfModule>

0 commit comments

Comments
 (0)