-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Global JetStream API request queue limiting #5900
Conversation
ee3cedb
to
f010813
Compare
438dbc2
to
f2ee47d
Compare
8d16b37
to
bd2e80e
Compare
Signed-off-by: Neil Twigg <[email protected]>
bd2e80e
to
1b7997d
Compare
pending, _ := s.jsAPIRoutedReqs.push(&jsAPIRoutedReq{jsub, sub, acc, subject, reply, copyBytes(rmsg), c.pa}) | ||
if pending >= warnThresh { | ||
s.rateLimitFormatWarnf("JetStream request queue has high pending count: %d", pending) | ||
limit := atomic.LoadInt64(&js.queueLimit) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One trick here we could do is that we know hard limit is greater them warn limit, so only if we hit warn limit do we look up limit with atomic and check hard limit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can do as a followup once we figure out test approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This should provide some protection against the server being completely overwhelmed by a build-up of JS API requests.
Signed-off-by: Neil Twigg [email protected]