-
Notifications
You must be signed in to change notification settings - Fork 84
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
Schedule-based autoscaling #448
Comments
You had asked for feedback in #61 . I've been using the community cron plugin for a day for a use-case similar to your example above. It works well for me so far (after some finagling since I operate While that plugin's cron notation is very simple: Adding clock scheduling as a first-class One difference in our use case, relative to your example, is that we start/stop the services daily. That would be more difficult to express if we only had start/end intervals (we would need to configure multiple intervals), but start+duration fixes that. Outside that interval, I want the count to be 0, which I think would happen if I configure the group's I note that hashicorp/cronexpr has this warning: When documenting this, be sure to indicate how timezones work in the cron expression... is it UTC or local? System |
Thank you for the feedback @neomantra, this is very helpful. And very good point about the timezones, in general I would say they always be UTC based.
I think this would be covered by these two blocks from the example? # Scale to 10 instances from 9:00AM to 4:30PM.
check "market_hours" {
enabled_schedule {
start = "0 9 * * *"
end = "30 16 * * *"
}
strategy "fixed-value" {
count = 10
}
}
# Scale to 3 instances from 4:30PM to 9:00AM.
check "off_market_hours" {
enabled_schedule {
start = "30 16 * * *"
end = "0 9 * * *"
}
strategy "fixed-value" {
count = 3
}
} Except that you would have |
@lgfa29 I see now, I'm not sure what I was thinking then. How would conflict resolution work? An obvious one would be overlapping It would be hard to confirm the impact in a pre-flight check, besides the naive "no overlapping start/stop schedules"; maybe do that and have some override for the advanced uses. |
Conflict resolution would be handled the same way it's currently done, with the safest
|
Is this feature implemented or do we have to use the community plugin for this? |
Would love to see this as native functionality as well. We currently scale down to 0 at the end of each business day and then back up in the morning, but the autoscaler prevents this by scaling this back up to the target level every time the autoscaling group tries to scale down per it's schedule. |
Hi @patademahesh 👋 No, this feature has not been implemented yet. I have not used the plugin, so I can't provide any guidance there, but you should give it a try and see if meets your needs. We initially tried to implement this as a plugin but we found some use cases that would be possible to handle, so this would require some changes in the Autoscaler core. @schematis that's the main use case we envision for this, but we haven't had the chance to properly roadmap it yet. If you haven't already, don't forget to add a 👍 to the original message so we can properly gauge interest 🙂 |
Hello @lgfa29 , maybe a good thing to put in this issue is also to be able to restart a job in a specific time. Eg.: In trading we need an app (raw_exec) to be restarted precisely at (as example) 09:58 am. Right now we're doing it with an in-house cron-like scheduler, but if we use this autoscaling feature described in this issue would suggest that we need to have a scale down to 0 at 9:57 and scale up to 1 at 9:58, which would make a minute without the app running., which is not good. Something like: # Restart app at 9:58 every business day
schedules {
restart = "58 9 * * 1-5" # “At 09:58 on every day-of-week from Monday through Friday.”
}
|
Hi @caiodelgadonew 👋 I think job restart falls outside the scope for the autoscaler. I would also be worried about using the autoscaler, an eventually consistent system, to perform time sensitive tasks. Even with this proposal we can't really guarantee that your policy will be executed exactly at 9:57 since policies are evaluated in an interval (grey arrows in the diagram) that may not be aligned with the specific time you need. For scheduled one-shot operations a |
I agree with you, maybe not a topic for here but something missing on the ui is the possibility to "restart all job allocs" something that can be done by the cli but in the ui we need to go through all allocs and restart them one by one, will check later if there's that in the API |
There's no API for that yet because async coordinated alloc restart are very tricky to implement, that's why the If all you need is a simple loop of restarts you can use the |
Autoscaling is usually a response action to some observed change in workload. But in some scenarios, the workload change has a well-defined and predictable periodicity. For these types of load, being able to preemptively schedule changes would be very useful.
The schedule-based autoscaling feature will allow operators to control a time window for when policies or individual
check
s are enabled or disabled. Policies are still evaluated in the interval defined byevaluation_interval
attributed, but when the evaluation falls outside this time window, the policy orcheck
will have no effect.This will be done using a new block called
enabled_schedule
that can be placed inside apolicy
orcheck
block. This new block will take astart
cron expression that defines when the enabled time window starts. To define the end limit of the window, either aend
cron expression or aduration
string formatted as a Go duration can be passed.The following examples define the same time window for when this policy is enabled: Mondays through Fridays from midnight to 11:59PM.
This approach allows operators to use the strategy that best fits their use-case. A policy inside a job file would look like as follows:
The text was updated successfully, but these errors were encountered: