Skip to content

add maxrequestworkers parameter for mpm_worker module #2331

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions manifests/mod/worker.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this will show up slightly better in the rendered strings documentation

Suggested change
# Maximum number of connections that will be processed simultaneously
# 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 (
Expand All @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions spec/classes/mod/worker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
{
serverlimit: 10,
startservers: 11,
maxclients: 12,
maxrequestworkers: 12,
minsparethreads: 13,
maxsparethreads: 14,
threadsperchild: 15,
Expand All @@ -126,7 +126,8 @@
it { is_expected.to contain_file('/etc/httpd/conf.modules.d/worker.conf').with(content: %r{^<IfModule mpm_worker_module>$}) }
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$}) }
Expand Down
6 changes: 5 additions & 1 deletion templates/mod/worker.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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 -%>
</IfModule>