Skip to content

Commit

Permalink
Merge pull request #1185 from mwhahaha/ticket/2432-worker_listenbacklog
Browse files Browse the repository at this point in the history
Add ListenBacklog for mod worker (MODULES-2432)
  • Loading branch information
Morgan Haskel committed Aug 19, 2015
2 parents 8ef4ee5 + d245182 commit a34f171
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 1 deletion.
56 changes: 56 additions & 0 deletions manifests/mod/worker.pp
Original file line number Diff line number Diff line change
@@ -1,3 +1,57 @@
# == Class: apache::mod::worker
#
#
# === Parameters
#
# [*startservers*]
# (optional) The number of child server processes created on startup
# Defaults is '2'
#
# [*maxclients*]
# (optional) 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.
# Default is '150'
#
# [*minsparethreads*]
# (optional) Minimum number of idle threads to handle request spikes.
# Default is '25'
#
# [*maxsparethreads*]
# (optional) Maximum number of idle threads.
# Default is '75'
#
# [*threadsperchild*]
# (optional) The number of threads created by each child process.
# Default is '25'
#
# [*maxrequestsperchild*]
# (optional) Limit on the number of connectiojns an individual child server
# process will handle. This is the old name and is still supported. The new
# name is MaxConnectionsPerChild as of 2.3.9+.
# Default is '0'
#
# [*serverlimit*]
# (optional) With worker, use this directive only if your MaxRequestWorkers
# and ThreadsPerChild settings require more than 16 server processes
# (default). Do not set the value of this directive any higher than the
# number of server processes required by what you may want for
# MaxRequestWorkers and ThreadsPerChild.
# Default is '25'
#
# [*threadlimit*]
# (optional) This directive sets the maximum configured value for
# ThreadsPerChild for the lifetime of the Apache httpd process.
# Default is '64'
#
# [*listenbacklog*]
# (optional) Maximum length of the queue of pending connections.
# Defaults is '511'
#
# [*apache_version*]
# (optional)
# Default is $::apache::apache_version
#
class apache::mod::worker (
$startservers = '2',
$maxclients = '150',
Expand All @@ -7,6 +61,7 @@
$maxrequestsperchild = '0',
$serverlimit = '25',
$threadlimit = '64',
$listenbacklog = '511',
$apache_version = $::apache::apache_version,
) {
if defined(Class['apache::mod::event']) {
Expand Down Expand Up @@ -36,6 +91,7 @@
# - $maxrequestsperchild
# - $serverlimit
# - $threadLimit
# - $listenbacklog
file { "${::apache::mod_dir}/worker.conf":
ensure => file,
content => template('apache/mod/worker.conf.erb'),
Expand Down
5 changes: 4 additions & 1 deletion spec/classes/mod/worker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@
it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+ThreadsPerChild\s+25$/) }
it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+MaxRequestsPerChild\s+0$/) }
it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+ThreadLimit\s+64$/) }
it { should contain_file("/etc/httpd/conf.d/worker.conf").with(:content => /^\s*ListenBacklog\s*511/) }
end

context 'setting params' do
Expand All @@ -169,7 +170,8 @@
:maxsparethreads => 14,
:threadsperchild => 15,
:maxrequestsperchild => 16,
:threadlimit => 17
:threadlimit => 17,
:listenbacklog => 8,
}
end
it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^<IfModule mpm_worker_module>$/) }
Expand All @@ -181,6 +183,7 @@
it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+ThreadsPerChild\s+15$/) }
it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+MaxRequestsPerChild\s+16$/) }
it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+ThreadLimit\s+17$/) }
it { should contain_file("/etc/httpd/conf.d/worker.conf").with(:content => /^\s*ListenBacklog\s*8/) }
end
end
end
1 change: 1 addition & 0 deletions templates/mod/worker.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
ThreadsPerChild <%= @threadsperchild %>
MaxRequestsPerChild <%= @maxrequestsperchild %>
ThreadLimit <%= @threadlimit %>
ListenBacklog <%= @listenbacklog %>
</IfModule>

0 comments on commit a34f171

Please sign in to comment.