backend ratelimit: support reloadable config file
Add support for a backend_ratelimit_conf_path option in the [filter:backend_ratelimit] config. If specified then the middleware will give precedence to config options from that file over config options from the [filter:backend_ratelimit] section. The path defaults to /etc/swift/backend-ratelimit.conf. The config file is periodically reloaded and any changed options are applied. The middleware will log a warning the first time it fails to load a config file that had previously been successfully loaded. The middleware also logs at info level when it first successfully loads a config file that had previously failed to be loaded. Otherwise, the middleware will log when a config file is loaded that results in the config being changed. Change-Id: I6554e37c6ab5b0a260f99b54169cb90ab5718f81
This commit is contained in:
@@ -130,15 +130,17 @@ use = egg:swift#recon
|
||||
|
||||
[filter:backend_ratelimit]
|
||||
use = egg:swift#backend_ratelimit
|
||||
# Set the maximum rate of requests per second per device per worker. Beyond
|
||||
# this rate the server will return 529 responses and emit a 'backend.ratelimit'
|
||||
# statsd metric without logging. The default value of zero causes no
|
||||
# rate-limiting to be applied.
|
||||
# requests_per_device_per_second = 0.0
|
||||
#
|
||||
# Set the number of seconds of unused rate-limiting allowance that can
|
||||
# accumulate and be used to allow a subsequent burst of requests.
|
||||
# requests_per_device_rate_buffer = 1.0
|
||||
# Config options can optionally be loaded from a separate config file. Config
|
||||
# options in this section will be used unless the same option is found in the
|
||||
# config file, in which case the config file option will be used. See the
|
||||
# backend-ratelimit.conf-sample file for details of available config options.
|
||||
# backend_ratelimit_conf_path = /etc/swift/backend-ratelimit.conf
|
||||
|
||||
# The minimum interval between attempts to reload any config file at
|
||||
# backend_ratelimit_conf_path while the server is running. A value of 0 means
|
||||
# that the file is loaded at start-up but not subsequently reloaded. Note that
|
||||
# config options in this section are never reloaded after start-up.
|
||||
# config_reload_interval = 60
|
||||
|
||||
[account-replicator]
|
||||
# You can override the default log routing for this app here (don't use set!):
|
||||
|
||||
10
etc/backend-ratelimit.conf-sample
Normal file
10
etc/backend-ratelimit.conf-sample
Normal file
@@ -0,0 +1,10 @@
|
||||
[backend_ratelimit]
|
||||
# Set the maximum rate of requests per second per device per worker. Beyond
|
||||
# this rate the server will return 529 responses and emit a 'backend.ratelimit'
|
||||
# statsd metric without logging. The default value of zero causes no
|
||||
# rate-limiting to be applied.
|
||||
# requests_per_device_per_second = 0.0
|
||||
#
|
||||
# Set the number of seconds of unused rate-limiting allowance that can
|
||||
# accumulate and be used to allow a subsequent burst of requests.
|
||||
# requests_per_device_rate_buffer = 1.0
|
||||
@@ -140,15 +140,17 @@ use = egg:swift#recon
|
||||
|
||||
[filter:backend_ratelimit]
|
||||
use = egg:swift#backend_ratelimit
|
||||
# Set the maximum rate of requests per second per device per worker. Beyond
|
||||
# this rate the server will return 529 responses and emit a 'backend.ratelimit'
|
||||
# statsd metric without logging. The default value of zero causes no
|
||||
# rate-limiting to be applied.
|
||||
# requests_per_device_per_second = 0.0
|
||||
#
|
||||
# Set the number of seconds of unused rate-limiting allowance that can
|
||||
# accumulate and be used to allow a subsequent burst of requests.
|
||||
# requests_per_device_rate_buffer = 1.0
|
||||
# Config options can optionally be loaded from a separate config file. Config
|
||||
# options in this section will be used unless the same option is found in the
|
||||
# config file, in which case the config file option will be used. See the
|
||||
# backend-ratelimit.conf-sample file for details of available config options.
|
||||
# backend_ratelimit_conf_path = /etc/swift/backend-ratelimit.conf
|
||||
|
||||
# The minimum interval between attempts to reload any config file at
|
||||
# backend_ratelimit_conf_path while the server is running. A value of 0 means
|
||||
# that the file is loaded at start-up but not subsequently reloaded. Note that
|
||||
# config options in this section are never reloaded after start-up.
|
||||
# config_reload_interval = 60
|
||||
|
||||
[container-replicator]
|
||||
# You can override the default log routing for this app here (don't use set!):
|
||||
|
||||
@@ -244,15 +244,17 @@ use = egg:swift#recon
|
||||
|
||||
[filter:backend_ratelimit]
|
||||
use = egg:swift#backend_ratelimit
|
||||
# Set the maximum rate of requests per second per device per worker. Beyond
|
||||
# this rate the server will return 529 responses and emit a 'backend.ratelimit'
|
||||
# statsd metric without logging. The default value of zero causes no
|
||||
# rate-limiting to be applied.
|
||||
# requests_per_device_per_second = 0.0
|
||||
#
|
||||
# Set the number of seconds of unused rate-limiting allowance that can
|
||||
# accumulate and be used to allow a subsequent burst of requests.
|
||||
# requests_per_device_rate_buffer = 1.0
|
||||
# Config options can optionally be loaded from a separate config file. Config
|
||||
# options in this section will be used unless the same option is found in the
|
||||
# config file, in which case the config file option will be used. See the
|
||||
# backend-ratelimit.conf-sample file for details of available config options.
|
||||
# backend_ratelimit_conf_path = /etc/swift/backend-ratelimit.conf
|
||||
|
||||
# The minimum interval between attempts to reload any config file at
|
||||
# backend_ratelimit_conf_path while the server is running. A value of 0 means
|
||||
# that the file is loaded at start-up but not subsequently reloaded. Note that
|
||||
# config options in this section are never reloaded after start-up.
|
||||
# config_reload_interval = 60
|
||||
|
||||
[object-replicator]
|
||||
# You can override the default log routing for this app here (don't use set!):
|
||||
|
||||
Reference in New Issue
Block a user