Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add RANDOM_DELAY to spread backup start in swarm #79

Closed
NeuerUser opened this issue Feb 21, 2021 · 4 comments
Closed

add RANDOM_DELAY to spread backup start in swarm #79

NeuerUser opened this issue Feb 21, 2021 · 4 comments

Comments

@NeuerUser
Copy link

When all backups in a swarm start at the same time, there might be performance issues. Some cron implementations support the RANDOM_DELAY environment variable, which defines the maximum amount of minutes the cron job could be randomly delayed. This could help to reduce strain on the swarm during backup.

@ThomDietrich
Copy link
Contributor

ThomDietrich commented Feb 22, 2021

I support this.
If you have the needed bash experience feel free to propose the change as a PR or here in this ticket.

Side note: Turns out this variable is commonly interpreted as minutes. I'm triggered by this as "random delay" could be in any time unit. The name is horrible. Suggest to go with RANDOM_DELAY_MINUTES_MAX.

@ThomDietrich
Copy link
Contributor

To clarify. I don't think the used go cron implementation supports RANDOM_DELAY. We can simply add the delay in bash, which has no downsides and gives us more control (for whichever reason). @djmaze are you personally interested to add this functionality in go-cron?

@djmaze
Copy link
Owner

djmaze commented Feb 24, 2021

To be precise, I had already been playing around with ways to spread backup times in a swarm cluster. As random delays might still collide, I was hoping to achieve deterministic run times for every node. Turns out this is really hard to do when deploying as a global swarm service.

As I have been talking about here and there, I am hoping to have a central scheduler solution with swarm-cronjob someday, but it does not yet work correctly for global mode services.

Using the random delay might be a good interim solution until we have that.

  • It could be added to go-cron but ideally to the upstream cron library where a suitable PR has been closed quite some time ago. Maybe it should be looked at again.
  • But, even easier, as @ThomDietrich said adding a sleep with a random delay to the backup script could be enough. I think that would be a good solution until we have something more sophisticated.

@stale
Copy link

stale bot commented Jun 2, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jun 2, 2021
@stale stale bot closed this as completed Jun 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants