zalando / postgres-operator

Postgres operator creates and manages PostgreSQL clusters running in Kubernetes
https://postgres-operator.readthedocs.io/
MIT License
4.37k stars 980 forks source link

Spread BACKUP_SCHEDULE #2465

Open pierreozoux opened 1 year ago

pierreozoux commented 1 year ago

We currently deploy around 80 postgres instances with this env var:

  - name: BACKUP_SCHEDULE
    value: 0 */6 * * *

We notice a cpu/disk/network spike around that time.

It would be nice if there was a feature to spread this "every 6 hours" cron.

For instance, we could have a new env var that would be something like: BACKUP_SCHEDULE_SPREAD_HOURLY=true

If if true, would put rand(0, 59) in the first cron value.

https://github.com/zalando/spilo/blob/d554db0d02806342123fc6a143fd84494c53ca9b/postgres-appliance/scripts/configure_spilo.py#L996-L998

pierreozoux commented 1 year ago

FYI, we have developed a "wrapper" operator (basically, it provisions minio buckets and pg), and we fixed it this way: https://forge.liiib.re/indiehost/libre.sh/postgres-operator/-/commit/6b3f1542cfbe250f05c1ef9e230dc014eb48e252