-
Notifications
You must be signed in to change notification settings - Fork 7
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
Reject series/write requests when max pending request limit is hit #114
Conversation
174dd33
to
d52aa34
Compare
d52aa34
to
2651ebf
Compare
level.Info(logger).Log("msg", "set max pending gRPC write request in limiter", "max_pending_requests", conf.maxPendingGrpcWriteRequests) | ||
} | ||
limiter, err := receive.NewLimiterWithOptions( | ||
conf.writeLimitsConfig, |
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.
consider reuse the writeLimitsConfig so less interface changes?
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.
I agree that it'd be ideal to have this config field in writeLimitsConfig
, but DB pods don't load writeLimitsConfig
at all. Pantheon-writer pods load that config. I'll have to keep it this way.
The interface is not changed. receive.NewLimiter()
stays the same. I added another function receive.NewLimiterWithOptions()
.
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.
got it, that's fair, do you wanna add some unit tests for limiter to test the load shedding behavior?
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.
left a few comments, great job, i think we should also track remote write pending writes using limiter
// Value 0 disables the feature. | ||
maxPendingRequests int32 | ||
pendingRequests atomic.Int32 | ||
maxPendingRequestLimitHit prometheus.Counter |
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. Shall we consider adding an alert around this metrics?
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.
Definitely once the counter is there.
0398fdc
to
cb958ba
Compare
@@ -1083,12 +1073,15 @@ func quorumReached(successes []int, successThreshold int) bool { | |||
|
|||
// RemoteWrite implements the gRPC remote write handler for storepb.WriteableStore. | |||
func (h *Handler) RemoteWrite(ctx context.Context, r *storepb.WriteRequest) (*storepb.WriteResponse, error) { | |||
if h.Limiter.ShouldRejectNewRequest() { |
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.
nice, let's add a unit test for this behavior?
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.
I can do that in a follow-up PR while testing it in Dev. It's quite tricky to write a unit test for such a feature. I want to see how useful it's in Dev before spending time on it.
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, thank you for doing this!
This is to prevent Receive server from begin overloaded
Tested in
dev-aws-eu-west-1