Increase and randomize healthcheck interval to avoid cpu congestion.
All the healthcheck timers are triggered at the same time which causes cpu congestion. With the default interval of 30s this cause unnecessary stress on the environment. We increase the default interval and randomize the trigger to 3/4 of the timer. Tasks, on average and by default, should thus still be triggered every minute, but ranging from 15s to 1m45s. Change-Id: Ib11b08b5d0dec03db9740520f05fe8f1ff962192 Closes-Bug: #1814870
This commit is contained in:
parent
4f7e8d5178
commit
074930f2a2
|
@ -188,11 +188,12 @@ def healthcheck_timer_create(container, cconfig, sysdir='/etc/systemd/system/',
|
|||
healthcheck_timer = service + '_healthcheck.timer'
|
||||
sysd_timer_f = sysdir + healthcheck_timer
|
||||
log.debug('Creating systemd timer file: %s' % sysd_timer_f)
|
||||
interval = cconfig.get('check_interval', 30)
|
||||
interval = cconfig.get('check_interval', 60)
|
||||
s_config = {
|
||||
'name': container,
|
||||
'service': service,
|
||||
'interval': interval
|
||||
'interval': interval,
|
||||
'randomize': int(interval) * 3 / 4
|
||||
}
|
||||
with open(sysd_timer_f, 'w') as timer_file:
|
||||
os.chmod(timer_file.name, 0o644)
|
||||
|
@ -201,6 +202,7 @@ Description=%(name)s container healthcheck
|
|||
[Timer]
|
||||
OnActiveSec=120
|
||||
OnUnitActiveSec=%(interval)s
|
||||
RandomizedDelaySec=%(randomize)s
|
||||
[Install]
|
||||
WantedBy=timers.target""" % s_config)
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue