woodpecker-ci / autoscaler

Scale your woodpecker agents automatically to the moon and back based on the current load.
Apache License 2.0
30 stars 6 forks source link

What is the difference between `WOODPECKER_AGENT_INACTIVITY_TIMEOUT` and `WOODPECKER_AGENT_IDLE_TIMEOUT`? #164

Open pat-s opened 3 months ago

pat-s commented 3 months ago

There is also WOODPECKER_AGENT_ALLOWED_STARTUP_TIME which is an alias for WOODPECKER_AGENT_INACTIVITY_TIMEOUT.

anbraten commented 3 months ago

WOODPECKER_AGENT_INACTIVITY_TIMEOUT is the timeout used to mark an agent for removal as it hasn't connected for a while (or not at all like an error in the config). Startup time is an old setting which was pretty confusing to me and is now kept to be at least somehow backwards compatible.

Only agents that have been inactive for the duration defined by WOODPECKER_AGENT_IDLE_TIMEOUT will be marked for removal. This way we don't remove agents immediately if they haven't been used for a short amount of time.

@lukashass also noted that the settings should be explained / improved in https://github.com/woodpecker-ci/autoscaler/pull/162#issuecomment-2205981833.

There is also the idea in https://github.com/woodpecker-ci/autoscaler/issues/73#issuecomment-2061374372 to support some kind of removal window so in case of providers like Hetzner an angent is removed at the end of an hour only or kept for another one to maximise cost efficiency. However I am not sure how to implement that in a generic way.

PRs and suggestions how we could document or implement those parts are highly appreciated.