Rate limit the job submission request - #866
Open
hellolittlej wants to merge 1 commit into
Open
Conversation
hellolittlej
requested review from
Andyz26,
calvin681,
dtrager02,
fdc-ntflx and
james-lubin
as code owners
July 30, 2026 17:06
hellolittlej
force-pushed
the
rate-limit-job-submission
branch
2 times, most recently
from
August 4, 2026 20:30
9cfd8a5 to
a8c0223
Compare
hellolittlej
force-pushed
the
rate-limit-job-submission
branch
3 times, most recently
from
August 5, 2026 06:43
ca6bbe8 to
8d0199a
Compare
hellolittlej
force-pushed
the
rate-limit-job-submission
branch
from
August 11, 2026 18:06
8d0199a to
168d7d6
Compare
Andyz26
reviewed
Aug 11, 2026
| jobRouteHandler, | ||
| system); | ||
| system, | ||
| ApiRequestRateLimiter.UNLIMITED); |
Collaborator
There was a problem hiding this comment.
can this be default so root signature remain the same?
Collaborator
Author
There was a problem hiding this comment.
This is v0 route test but it's using the v1 job route with the legacy reason. ...
I prefer we not adding the overload just to accommodate a legacy test setup.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds an opt-in, per route based bucket rate limit.For jobsRoute, add the rate limit in front of the three v1 job-creation endpoints:
POST /api/v1/jobsPOST /api/v1/jobClusters/{cluster}/jobsPOST /api/v1/jobs/actions/quickSubmitThe rate
Configuration
mantis.master.api.v1.submitJob.throttle.enabledfalsemantis.master.api.v1.submitJob.permitsPerSecond1000Off by default because the right ceiling depends on cluster size and traffic —
operators opt in once they've measured their own submit rate. The rate is backed by a
LongDynamicProperty, so it re-reads on the dynamic-property refresh interval(
mantis.config.dynamic.refreshSecs, default 30s).Metrics
MasterApiMetrics/throttledRequestCountgains asourcetag (submitJob,resourceCluster), so an operator can tell which limit is shedding. Previously theroute-level throttle and the resource-cluster gateway's
RequestThrottledExceptionboth incremented the same untagged counter.
Checklist
./gradlew buildcompiles code correctly./gradlew testpasses all tests