Add proxy config option to set recoverable_node_timeout

This setting defaults to node_timeout if unset, which affects HEAD, GET
and PUT requests. However, it makes sense to keep the timeout for GET
and HEAD requests shorter to allow quicker recovery and prevent client
timeouts.

Change-Id: I2f56bc456427d5deb30d86ad70e890d0897ef0c9
This commit is contained in:
Christian Schwede 2020-09-11 15:17:58 +02:00
parent 0504cf2dbf
commit 4d9315ec54
3 changed files with 18 additions and 0 deletions

View File

@ -102,6 +102,10 @@
# (optional) Configures node_timeout for swift proxy-server
# Defaults to undef.
#
# [*recoverable_node_timeout*]
# (optional) Configures recoverable_node_timeout for swift proxy-server
# Defaults to undef.
#
# [*enabled*]
# (optional) Should the service be enabled.
# Defaults to true
@ -175,6 +179,7 @@ class swift::proxy(
$write_affinity_node_count = undef,
$client_timeout = undef,
$node_timeout = undef,
$recoverable_node_timeout = undef,
$manage_service = true,
$enabled = true,
$package_ensure = 'present',
@ -260,6 +265,7 @@ and swift::proxy::s3api instead')
'app:proxy-server/write_affinity': value => $write_affinity;
'app:proxy-server/write_affinity_node_count': value => $write_affinity_node_count;
'app:proxy-server/node_timeout': value => $node_timeout;
'app:proxy-server/recoverable_node_timeout': value => $recoverable_node_timeout;
}
if $cors_allow_origin {

View File

@ -0,0 +1,7 @@
---
features:
- |
Adds a new proxy config option to set recoverable_node_timeout. This
setting defaults to node_timeout, which affects HEAD, GET and PUT requests.
However, it makes sense to keep the timeout for GET and HEAD requests
shorter to allow quicker recovery and prevent client timeouts.

View File

@ -117,6 +117,7 @@ describe 'swift::proxy' do
:write_affinity_node_count => '2 * replicas',
:client_timeout => '120',
:node_timeout => '20',
:recoverable_node_timeout => '15',
:cors_allow_origin => 'http://foo.bar:1234,https://foo.bar',
}
end
@ -151,6 +152,7 @@ describe 'swift::proxy' do
it { should contain_swift_proxy_config('app:proxy-server/write_affinity').with_value('r1') }
it { should contain_swift_proxy_config('app:proxy-server/write_affinity_node_count').with_value('2 * replicas') }
it { should contain_swift_proxy_config('app:proxy-server/node_timeout').with_value('20') }
it { should contain_swift_proxy_config('app:proxy-server/recoverable_node_timeout').with_value('15') }
end
describe "when log udp port is set" do
@ -170,6 +172,7 @@ describe 'swift::proxy' do
:write_affinity => 'r1',
:write_affinity_node_count => '2 * replicas',
:node_timeout => '20',
:recoverable_node_timeout => '15',
:cors_allow_origin => 'http://foo.bar:1234,https://foo.bar',
}
end
@ -194,6 +197,7 @@ describe 'swift::proxy' do
:write_affinity => 'r1',
:write_affinity_node_count => '2 * replicas',
:node_timeout => '20',
:recoverable_node_timeout => '15',
:cors_allow_origin => 'http://foo.bar:1234,https://foo.bar',
}
end
@ -231,6 +235,7 @@ describe 'swift::proxy' do
it { should contain_swift_proxy_config('app:proxy-server/write_affinity').with_value('r1') }
it { should contain_swift_proxy_config('app:proxy-server/write_affinity_node_count').with_value('2 * replicas') }
it { should contain_swift_proxy_config('app:proxy-server/node_timeout').with_value('20') }
it { should contain_swift_proxy_config('app:proxy-server/recoverable_node_timeout').with_value('15') }
end
end