Skip to content

Add request-level maximum scale option - #2246

Merged
ashdza merged 13 commits into
masterfrom
request-level-maxscale
Dec 6, 2021
Merged

Add request-level maximum scale option #2246
ashdza merged 13 commits into
masterfrom
request-level-maxscale

Conversation

@ashdza

@ashdza ashdza commented Nov 23, 2021

Copy link
Copy Markdown
Contributor

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
private final RequestType requestType;
private final Optional<List<String>> owners;
private final Optional<Integer> numRetriesOnFailure;
private final Optional<Integer> maxScale;

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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)

@ashdza ashdza Nov 29, 2021

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
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
Copy Markdown
Contributor

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

);

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

Copy link
Copy Markdown
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)

@ashdza ashdza Nov 29, 2021

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
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
@ashdza
ashdza requested a review from pschoenfelder November 29, 2021 23:12
@pschoenfelder

Copy link
Copy Markdown
Contributor

🚢

@pschoenfelder

Copy link
Copy Markdown
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.

4 participants