mimirpb: fix RW2 write request splitting - #16295
Open
aknuds1 wants to merge 1 commit into
Open
Conversation
aknuds1
force-pushed
the
arve/fix-rw2-write-request-splitting
branch
from
August 4, 2026 16:24
761a41c to
9254f43
Compare
4 tasks
aknuds1
force-pushed
the
arve/ruler-split-remote-distributor-writes
branch
7 times, most recently
from
August 5, 2026 07:44
b7df148 to
e3e3ac8
Compare
aknuds1
added a commit
that referenced
this pull request
Aug 5, 2026
<!-- Thanks for sending a pull request! Before submitting: 1. Read our CONTRIBUTING.md guide 2. Rebase your PR if it gets out of sync with main --> #### What this PR does Remote ruler writes were previously sent as a single gRPC message, so large rule evaluation results could exceed `ruler.distributor.grpc_client_config.max_send_msg_size`. This PR derives a compression-safe effective payload limit, splits oversized Remote Write 1.0 requests at series boundaries, and sends the resulting requests sequentially. Each generated request has its own timeout and retry lifecycle. Successful earlier requests aren't rolled back if a later request fails, so a failed rule evaluation can leave partially written results. The ruler emits one float or native-histogram sample per result series for each evaluation. Consequently, an individual result series exceeding the effective split limit cannot be losslessly subdivided. If this occurs, increase `ruler.distributor.grpc_client_config.max_send_msg_size` and configure the distributor's `server.grpc_server_max_recv_msg_size` to be at least as large. When compression is enabled, a series above the conservative effective limit may still succeed if its compressed payload fits within the configured transport limit; otherwise gRPC returns `ResourceExhausted`. The implementation preserves request ownership and series ordering and reuses the RW1 write-request splitter already used by ingest storage to keep Kafka records within their configured size limit. The ruler adds compression-aware sizing, sequential gRPC sends, and per-request retries around that splitter. The `cortex_ruler_remote_distributor_requests_per_write_request` histogram reports how many remote requests each ruler write generates. This PR also fixes the RW1 splitter's protobuf embedded-message framing accounting and caps its initial preallocation for very small limits. The corresponding RW2 fixes are in #16295. #### Checklist - [x] Tests updated. - [x] Documentation added. - [x] `CHANGELOG.md` updated - the order of entries should be `[CHANGE]`, `[FEATURE]`, `[ENHANCEMENT]`, `[BUGFIX]`. If changelog entry is not needed, please add the `changelog-not-needed` label to the PR. - [ ] [`about-versioning.md`](https://github.com/grafana/mimir/blob/main/docs/sources/mimir/configure/about-versioning.md) updated with experimental features. Not applicable: this PR doesn't add an experimental feature or configuration surface. --------- Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com> Co-authored-by: Julius Hinze <julius.hinze@grafana.com>
Base automatically changed from
arve/ruler-split-remote-distributor-writes
to
main
August 5, 2026 14:36
Account for protobuf embedded-message framing when splitting Remote Write 2.0 requests, preserve request settings, and bound capacity estimates for small size limits.
aknuds1
force-pushed
the
arve/fix-rw2-write-request-splitting
branch
from
August 5, 2026 14:54
9254f43 to
92ec5a3
Compare
aknuds1
marked this pull request as ready for review
August 5, 2026 14:57
Contributor
|
please rebase this PR on latest main, otherwise it can't merge — it's blocked on required checks that will never report. context: #16335 changed the unit test CI matrix and the required checks got renamed ( |
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 this PR does
It follows the Remote Write 2.0 Kafka record-splitting pattern introduced in #12166 and fixes the split size calculation. The splitter previously counted a series' protobuf message payload but omitted the surrounding field key and length prefix when deciding whether another series fit. Requests containing multiple series near the configured producer record limit could therefore still exceed it.
The splitter now includes that embedded-message framing, preserves write-request settings across generated requests, returns the original request for non-positive limits, and caps its initial allocation at the number of series. As before, splitting is best-effort: a single series larger than the limit remains intact and may produce an oversized record.
Checklist
CHANGELOG.mdupdated - the order of entries should be[CHANGE],[FEATURE],[ENHANCEMENT],[BUGFIX].about-versioning.mdupdated with experimental features. Not applicable: this PR doesn't add an experimental feature or configuration surface.