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 request-level maximum scale option #2246

Merged
merged 13 commits into from
Dec 6, 2021
Merged

Conversation

ashdza
Copy link
Contributor

@ashdza ashdza commented Nov 23, 2021

This adds a maximum scale option at the request level for users to specify the maximum number of instances allowed for a particular request. Previously, there only existed a global limit in MesosConfiguration to prevent overscales that applied to all requests.

https://git.hubteam.com/HubSpot/PaaS-Run/issues/1546

@ashdza ashdza marked this pull request as draft November 23, 2021 21:12
)
public class SingularityRequest {
private final String id;
private final RequestType requestType;
private final Optional<List<String>> owners;
private final Optional<Integer> numRetriesOnFailure;
private final Optional<Integer> maxScale;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not entirely clear on how this new option would interact with autoscale

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks like AutoScale uses SingularityClient's scaleSingularityRequest (code), which hits this resource

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That resource uses SingularityValidator's checkScale, so you should the checkBadRequest also to that method so that AutoScale is blocked

(or make a checkBadScaleRequest method for both validator methods to use)

Copy link
Contributor Author

@ashdza ashdza Nov 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like checkScale doesn't currently check against the global max scale in MesosConfiguration, so AutoScale isn't blocked by that when scaling. Do we want it be blocked by the new request-level max scale option?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch — we should check both max scale values. Since Singularity has been missing this, we should verify that no active requests would be caught by the current maxNumInstancesPerRequest value before this is rolled out.

@ssalinas
Copy link
Member

I wonder if we should just put the validation of the scale in the constructor for SingularityRequest instead? That way it will be enforced everywhere the object is created, even failing client side when possible to make it even more apparent/faster

@@ -230,11 +230,17 @@ public SingularityRequest checkSingularityRequest(
!request.getInstances().isPresent() || request.getInstances().get() > 0,
"Instances must be greater than 0"
);

// check if requested number of instances exceeds max scale
int maxInstances = request.getMaxScale().isPresent()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be the lower of the two config values (i.e. a user shouldn't be able to exceed our global max scale by specifying a request level max scale)

Copy link
Contributor Author

@ashdza ashdza Nov 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. To confirm, does this mean global does not automatically override request-level and vice versa, and we instead want to always use the lower of the two when validating scale?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we should always use the lowest. Users should be able to further restrict the global option with a request level option, but not the other way around.

@ashdza ashdza marked this pull request as ready for review November 29, 2021 23:12
@pschoenfelder
Copy link
Contributor

🚢

@pschoenfelder
Copy link
Contributor

🚢

@ashdza ashdza merged commit c4b55c3 into master Dec 6, 2021
@ashdza ashdza deleted the request-level-maxscale branch December 16, 2021 16:23
@ssalinas ssalinas added this to the 1.5.0 milestone May 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants