Skip to content

Commit c706255

Browse files
committed
Merge pull request #130 from stefanandres/jetty_max_threads
implement max_threads option for jetty
2 parents b80b921 + 00838d8 commit c706255

6 files changed

Lines changed: 42 additions & 2 deletions

File tree

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,11 @@ Java VM options used for overriding default Java VM options specified in PuppetD
293293

294294
Example: to set `-Xmx512m -Xms256m` options use `{ '-Xmx' => '512m', '-Xms' => '256m' }`
295295

296+
####`max_threads`
297+
298+
Jetty option to explicetly set max-thread. The default is undef, so the PuppetDB-jetty default is used.
299+
300+
296301
### puppetdb:server
297302

298303
The `puppetdb::server` class manages the puppetdb server independently of the underlying database that it depends on. It will manage the puppetdb package, service, config files, etc., but will still allow you to manage the database (e.g. postgresql) however you see fit.

manifests/init.pp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
$puppetdb_service_status = $puppetdb::params::puppetdb_service_status,
3030
$open_postgres_port = $puppetdb::params::open_postgres_port,
3131
$confdir = $puppetdb::params::confdir,
32-
$java_args = {}
32+
$java_args = {},
33+
$max_threads = $puppetdb::params::max_threads
3334
) inherits puppetdb::params {
3435

3536
# Apply necessary suffix if zero is specified.
@@ -95,6 +96,7 @@
9596
puppetdb_service_status => $puppetdb_service_status,
9697
confdir => $confdir,
9798
java_args => $java_args,
99+
max_threads => $max_threads,
98100
}
99101

100102
if ($database == 'postgres') {

manifests/params.pp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
$conn_keep_alive = '45'
3535
$conn_lifetime = '0'
3636

37+
$max_threads = undef
38+
3739
case $::osfamily {
3840
'RedHat': {
3941
$firewall_supported = true

manifests/server.pp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
$puppetdb_service_status = $puppetdb::params::puppetdb_service_status,
2929
$confdir = $puppetdb::params::confdir,
3030
$manage_firewall = true,
31-
$java_args = {}
31+
$java_args = {},
32+
$max_threads = $puppetdb::params::max_threads
3233
) inherits puppetdb::params {
3334

3435
# Apply necessary suffix if zero is specified.
@@ -108,6 +109,7 @@
108109
ssl_listen_port => $ssl_listen_port,
109110
disable_ssl => $disable_ssl,
110111
confdir => $confdir,
112+
max_threads => $max_threads,
111113
notify => Service[$puppetdb_service],
112114
}
113115

manifests/server/jetty_ini.pp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
$ssl_listen_port = $puppetdb::params::ssl_listen_port,
77
$disable_ssl = $puppetdb::params::disable_ssl,
88
$confdir = $puppetdb::params::confdir,
9+
$max_threads = $puppetdb::params::max_threads,
910
) inherits puppetdb::params {
1011

1112
#Set the defaults
@@ -44,4 +45,16 @@
4445
setting => 'ssl-port',
4546
value => $ssl_listen_port,
4647
}
48+
49+
if ($max_threads) {
50+
ini_setting {'puppetdb_max_threads':
51+
setting => 'max-threads',
52+
value => $max_threads,
53+
}
54+
} else {
55+
ini_setting {'puppetdb_max_threads':
56+
ensure => absent,
57+
setting => 'max-threads',
58+
}
59+
}
4760
}

spec/unit/classes/server/jetty_ini_spec.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,5 +83,21 @@
8383
'setting' => 'ssl-port'
8484
)}
8585
end
86+
87+
describe 'when setting max_threads' do
88+
let(:params) do
89+
{
90+
'max_threads' => 150
91+
}
92+
end
93+
it { should contain_ini_setting('puppetdb_max_threads').
94+
with(
95+
'ensure' => 'present',
96+
'path' => '/etc/puppetdb/conf.d/jetty.ini',
97+
'section' => 'jetty',
98+
'setting' => 'max-threads',
99+
'value' => '150'
100+
)}
101+
end
86102
end
87103
end

0 commit comments

Comments
 (0)