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

JENKINS-66373: idle timeout should not fight with min spare instances setting #945

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sparrowt
Copy link
Contributor

@sparrowt sparrowt commented Mar 6, 2024

The problem

Currently if you use the "Minimum number of spare instances" setting as well as "Idle termination time", then there is a constant battle going on between:

  • MinimumInstanceChecker.checkForMinimumInstances provisioning new agents to try and maintain the minimum number of spare instances as configured
  • however the idle timeout checks in this method are killing off the 'spare' instances once they reach the idle termination time

This means that the spare instances are repeatedly killed & recreated as described on https://issues.jenkins.io/browse/JENKINS-66373 which is wasteful and means that, some percentage of the time, there are never enough spare instances because they are being booted (again).

Solution

This PR makes a simple change to the idle termination logic so that it takes account of "Minimum number of spare instances" in the same way that it already accounts for the main "Minimum number of instances" setting.

Testing done

None yet - EC2RetentionStrategyTest.java seems like the right place to add a test case for this specific scenario.

Right now I've got very limited time and wanted to at least get the proposed fix up for discussion to start with.

Submitter checklist

Edit tasklist title
Beta Give feedback Tasklist Submitter checklist, more options

Delete tasklist

Delete tasklist block?
Are you sure? All relationships in this tasklist will be removed.
  1. Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
    Options
  2. Ensure that the pull request title represents the desired changelog entry
    Options
  3. Please describe what you did
    Options
  4. Link to relevant issues in GitHub or Jira
    Options
  5. Link to relevant pull requests, esp. upstream and downstream changes
    Options
  6. Ensure you have provided tests - that demonstrates feature works or fixes the issue
    Options

… setting

Prior to this change, if you use "Minimum number of spare instances" setting as well as "Idle termination time", then there is a constant battle going on between:
- `checkForMinimumInstances` trying to maintain the minimum spare instances as requested
- the idle timeout checks in this method are killing off the 'spare' instances

Make this method take account of "Minimum number of _spare_ instances" in the same way that it already accounts for the main "Minimum number of instances" setting.
@sparrowt
Copy link
Contributor Author

@res0nance who would be good to have an initial review of this?

@res0nance
Copy link
Contributor

@res0nance who would be good to have an initial review of this?

Could you add some unit tests for this change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants