Merge "Adding speed limit options for DB auditor"

This commit is contained in:
Jenkins 2013-02-26 06:22:25 +00:00 committed by Gerrit Code Review
commit 249a65461e
7 changed files with 32 additions and 10 deletions

View File

@ -210,6 +210,8 @@ Logging level. The default is INFO.
Logging address. The default is /dev/log. Logging address. The default is /dev/log.
.IP \fBinterval\fR .IP \fBinterval\fR
Will audit, at most, 1 account per device per interval. The default is 1800 seconds. Will audit, at most, 1 account per device per interval. The default is 1800 seconds.
.IP \fBaccounts_per_second\fR
Maximum accounts audited per second. Should be tuned according to individual system specs. 0 is unlimited. The default is 200.
.RE .RE

View File

@ -237,6 +237,8 @@ Logging level. The default is INFO.
Logging address. The default is /dev/log. Logging address. The default is /dev/log.
.IP \fBinterval\fR .IP \fBinterval\fR
Will audit, at most, 1 container per device per interval. The default is 1800 seconds. Will audit, at most, 1 container per device per interval. The default is 1800 seconds.
.IP \fBcontainers_per_second\fR
Maximum containers audited per second. Should be tuned according to individual system specs. 0 is unlimited. The default is 200.
.RE .RE

View File

@ -424,14 +424,17 @@ account_suppression_time 60 Seconds to suppress updating an
[container-auditor] [container-auditor]
================== ================= ======================================= ===================== ================= =======================================
Option Default Description Option Default Description
------------------ ----------------- --------------------------------------- --------------------- ----------------- ---------------------------------------
log_name container-auditor Label used when logging log_name container-auditor Label used when logging
log_facility LOG_LOCAL0 Syslog log facility log_facility LOG_LOCAL0 Syslog log facility
log_level INFO Logging level log_level INFO Logging level
interval 1800 Minimum time for a pass to take interval 1800 Minimum time for a pass to take
================== ================= ======================================= containers_per_second 200 Maximum containers audited per second.
Should be tuned according to individual
system specs. 0 is unlimited.
===================== ================= =======================================
---------------------------- ----------------------------
Account Server Configuration Account Server Configuration
@ -515,6 +518,9 @@ log_name account-auditor Label used when logging
log_facility LOG_LOCAL0 Syslog log facility log_facility LOG_LOCAL0 Syslog log facility
log_level INFO Logging level log_level INFO Logging level
interval 1800 Minimum time for a pass to take interval 1800 Minimum time for a pass to take
accounts_per_second 200 Maximum accounts audited per second.
Should be tuned according to individual
system specs. 0 is unlimited.
==================== =============== ======================================= ==================== =============== =======================================
[account-reaper] [account-reaper]

View File

@ -92,6 +92,7 @@ use = egg:swift#recon
# interval = 1800 # interval = 1800
# log_facility = LOG_LOCAL0 # log_facility = LOG_LOCAL0
# log_level = INFO # log_level = INFO
# accounts_per_second = 200
# recon_cache_path = /var/cache/swift # recon_cache_path = /var/cache/swift
[account-reaper] [account-reaper]

View File

@ -107,6 +107,7 @@ use = egg:swift#recon
# log_address = /dev/log # log_address = /dev/log
# Will audit each container at most once per interval # Will audit each container at most once per interval
# interval = 1800 # interval = 1800
# containers_per_second = 200
# recon_cache_path = /var/cache/swift # recon_cache_path = /var/cache/swift
[container-sync] [container-sync]

View File

@ -21,7 +21,7 @@ import swift.common.db
from swift.account import server as account_server from swift.account import server as account_server
from swift.common.db import AccountBroker from swift.common.db import AccountBroker
from swift.common.utils import get_logger, audit_location_generator, \ from swift.common.utils import get_logger, audit_location_generator, \
config_true_value, dump_recon_cache config_true_value, dump_recon_cache, ratelimit_sleep
from swift.common.daemon import Daemon from swift.common.daemon import Daemon
from eventlet import Timeout from eventlet import Timeout
@ -38,6 +38,9 @@ class AccountAuditor(Daemon):
self.interval = int(conf.get('interval', 1800)) self.interval = int(conf.get('interval', 1800))
self.account_passes = 0 self.account_passes = 0
self.account_failures = 0 self.account_failures = 0
self.accounts_running_time = 0
self.max_accounts_per_second = \
float(conf.get('accounts_per_second', 200))
swift.common.db.DB_PREALLOCATION = \ swift.common.db.DB_PREALLOCATION = \
config_true_value(conf.get('db_preallocation', 'f')) config_true_value(conf.get('db_preallocation', 'f'))
self.recon_cache_path = conf.get('recon_cache_path', self.recon_cache_path = conf.get('recon_cache_path',
@ -67,6 +70,8 @@ class AccountAuditor(Daemon):
reported = time.time() reported = time.time()
self.account_passes = 0 self.account_passes = 0
self.account_failures = 0 self.account_failures = 0
self.accounts_running_time = ratelimit_sleep(
self.accounts_running_time, self.max_accounts_per_second)
return reported return reported
def run_forever(self, *args, **kwargs): def run_forever(self, *args, **kwargs):

View File

@ -23,7 +23,7 @@ import swift.common.db
from swift.container import server as container_server from swift.container import server as container_server
from swift.common.db import ContainerBroker from swift.common.db import ContainerBroker
from swift.common.utils import get_logger, audit_location_generator, \ from swift.common.utils import get_logger, audit_location_generator, \
config_true_value, dump_recon_cache config_true_value, dump_recon_cache, ratelimit_sleep
from swift.common.daemon import Daemon from swift.common.daemon import Daemon
@ -38,6 +38,9 @@ class ContainerAuditor(Daemon):
self.interval = int(conf.get('interval', 1800)) self.interval = int(conf.get('interval', 1800))
self.container_passes = 0 self.container_passes = 0
self.container_failures = 0 self.container_failures = 0
self.containers_running_time = 0
self.max_containers_per_second = \
float(conf.get('containers_per_second', 200))
swift.common.db.DB_PREALLOCATION = \ swift.common.db.DB_PREALLOCATION = \
config_true_value(conf.get('db_preallocation', 'f')) config_true_value(conf.get('db_preallocation', 'f'))
self.recon_cache_path = conf.get('recon_cache_path', self.recon_cache_path = conf.get('recon_cache_path',
@ -66,6 +69,8 @@ class ContainerAuditor(Daemon):
reported = time.time() reported = time.time()
self.container_passes = 0 self.container_passes = 0
self.container_failures = 0 self.container_failures = 0
self.containers_running_time = ratelimit_sleep(
self.containers_running_time, self.max_containers_per_second)
return reported return reported
def run_forever(self, *args, **kwargs): def run_forever(self, *args, **kwargs):