HomeClusterLabs Projects

Refactor: scheduler: greatly improve efficiency of interval-origin

Description

Refactor: scheduler: greatly improve efficiency of interval-origin

Previously, the next occurrence of a recurring operation for a given
interval-origin was determined by repeatedly adding the interval in seconds to
interval-origin until it was greater than now -- using full ISO 8601 logic to
account for leap years, etc. This is horribly inefficient, especially as the
time between interval-origin and now increases.

Now, a simple formula involving a few CPU cycles is used, after converting the
time objects to seconds.

Using the new crm_simulate --profile timings with --repeat 1000, on my test host
the CPU time for the "origin" scheduler regression test (with interval-origin
in 2014, and using the current "now" rather than the test "now") went from
162.69 seconds to 0.29 seconds.

Details

Provenance
kgaillotAuthored on Oct 10 2019, 12:56 PM
Parents
rP094c99849e3e: Build: GNUmakefile: always rebuild spec file
Branches
Unknown
Tags
Unknown

Event Timeline