Make the cron trigger execution interval configurable
The cron_trigger subsystem in Mistral queries the database every second to look for triggers that require execution. This can be very wasteful if your deployment only has cron triggers that run infrequently (every hour or day etc.). Letting operators configure this value reduces the load and allows the cron triggers to be useful in more scenarios. Operators do need to be aware that this configuration would limit the frequency of execution. For example, if the value is set to 600 then cron triggers configured to run every minute will only run every 10 minutes. Related-Bug: #1747386 Change-Id: I9060253bc416be28af4ef81f3edf694059d92066
This commit is contained in:
parent
7fac88cce5
commit
a1ab5d85cc
|
@ -251,6 +251,20 @@ cron_trigger_opts = [
|
|||
' performance.'
|
||||
)
|
||||
),
|
||||
cfg.IntOpt(
|
||||
'execution_interval',
|
||||
default=1,
|
||||
min=1,
|
||||
help=(
|
||||
'This setting defines how frequently Mistral checks for cron ',
|
||||
'triggers that need execution. By default this is every second ',
|
||||
'which can lead to high system load. Increasing the number will ',
|
||||
'reduce the load but also limit the minimum freqency. For ',
|
||||
'example, a cron trigger can be configured to run every second ',
|
||||
'but if the execution_interval is set to 60, it will only run ',
|
||||
'once per minute.'
|
||||
)
|
||||
)
|
||||
]
|
||||
|
||||
event_engine_opts = [
|
||||
|
|
|
@ -35,7 +35,8 @@ _periodic_tasks = {}
|
|||
|
||||
|
||||
class MistralPeriodicTasks(periodic_task.PeriodicTasks):
|
||||
@periodic_task.periodic_task(spacing=1, run_immediately=True)
|
||||
@periodic_task.periodic_task(spacing=CONF.cron_trigger.execution_interval,
|
||||
run_immediately=True)
|
||||
def process_cron_triggers_v2(self, ctx):
|
||||
LOG.debug("Processing cron triggers...")
|
||||
|
||||
|
|
Loading…
Reference in New Issue