When does the cleanup service run and can it be configured?

We run Grafana with mySQL db and noticed that the db instance spikes to 100% CPU nightly at the exact same time (8pm EST). Upon enabling the general logs, we noticed that Grafana is running some sort of cleanup and deleting annotations, dashboard versions, dashboard snapshots, old login attempts, etc. Is this scheduled for an exact time every night and is there any way to configure it or change the time? I wasn’t able to find any options in the docs.

I assume these config options are related though:
ANNOTATIONS_CLEANUPJOB_BATCHSIZE
ANNOTATIONS_DASHBOARD_MAX_AGE
ANNOTATIONS_DASHBOARD_MAX_ANNOTATIONS_TO_KEEP
ANNOTATIONS_API_MAX_AGE
ANNOTATIONS_API_MAX_ANNOTATIONS_TO_KEEP
ALERTING_MAX_ANNOTATION_AGE
ALERTING_MAX_ANNOTATIONS_TO_KEEP

Also looking for any other suggestions on how to reduce these CPU spikes during what appears to be Grafana’s nightly cleanup job.

Thank you!

Hi @laurenm

Do you think anything else could be running nightly? According to the code, the Grafana DB cleanup runs continually, every ~10min or so: