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

ingester: Enforce limits for Push requests coming via ingest.Store #7621

Merged
merged 3 commits into from
Mar 15, 2024

Conversation

narqo
Copy link
Contributor

@narqo narqo commented Mar 13, 2024

What this PR does

Following #7503

We noticed that ingest storage may slip from in-flight requests limits, after the deprecated LimitInflightRequestsUsingGrpcMethodLimiter (default true) will be removed. These changes update the ingester in way, so the in-flight limits were enforced when ingest storage is used.

The changes also prevent double-counting of the limits, during the migration period, when the ingesters will be deployed with enabled ingest storage, but the distributors will keep using gRPC API.

Which issue(s) this PR fixes or relates to

Fixes n/a

Checklist

  • Tests updated.
  • Documentation added.
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX].
  • about-versioning.md updated with experimental features.

@narqo narqo requested a review from a team as a code owner March 13, 2024 16:08
Comment on lines 20 to 23
type ingesterPushReceiver interface {
StartPushRequest(requestSize int64) error
FinishPushRequest(requestSize int64)
StartPushRequest(ctx context.Context, requestSize int64) (context.Context, error)
FinishPushRequest(ctx context.Context)
}
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 think a nice side effect of these changes, is that we don't need two interfaces ingesterPushReceiver and distributorPushReceiver any more. Here I kept them in place, but want to refactor this chunk further later.

@narqo narqo force-pushed the ingest-store-disable-grpc-inflight-limiter branch from 5a20206 to 276820b Compare March 13, 2024 16:13
Copy link
Member

@pstibrany pstibrany left a comment

Choose a reason for hiding this comment

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

I think there is a bug. When ingest store is enabled, but Push request arrives via gRPC (which we keep as an option, and may need during migrating cells), then i.StartPushRequest is correctly called from both gRPC method checker and from ingester, and it only "starts" the request once.

However both places also "finish" the request by calling FinishPushRequest or defer i.finishPushRequest(reqSize) respectively. And this will decrease inflightPushRequests twice.

In distributor we solve this by having pushHandlerPerformsCleanup in the request state, and this determines which component is responsible for cleanup -- either distributor itself, or grpc method check.

@narqo narqo force-pushed the ingest-store-disable-grpc-inflight-limiter branch from 276820b to d1dcf6d Compare March 15, 2024 12:53
@narqo
Copy link
Contributor Author

narqo commented Mar 15, 2024

I think there is a bug [..]

Very good point, thank you. I considered the case initially, but it slipped from the implementation. I should've added a test for the change from the beginning. PHAL

@narqo narqo requested a review from pstibrany March 15, 2024 13:05
Copy link
Member

@pstibrany pstibrany left a comment

Choose a reason for hiding this comment

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

Thank you, changes look good to me. I've left some minor comments that I'd like to see addressed before merging.

@narqo narqo force-pushed the ingest-store-disable-grpc-inflight-limiter branch from d1dcf6d to 6f3b2bc Compare March 15, 2024 15:14
Copy link
Member

@pstibrany pstibrany left a comment

Choose a reason for hiding this comment

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

Thank you very much!

@pstibrany pstibrany enabled auto-merge (squash) March 15, 2024 15:17
@pstibrany pstibrany merged commit 44e3ebc into main Mar 15, 2024
29 checks passed
@pstibrany pstibrany deleted the ingest-store-disable-grpc-inflight-limiter branch March 15, 2024 15:29
Copy link
Collaborator

@pracucci pracucci left a comment

Choose a reason for hiding this comment

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

Nice job. LGTM too.

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.

3 participants