Skip to content

fix(bench): RFC 0031 — byte-capped Loki push batching (run #2 finding) - #476

Merged
jensholdgaard merged 4 commits into
mainfrom
rfc0031-byte-capped-push
Jul 11, 2026
Merged

fix(bench): RFC 0031 — byte-capped Loki push batching (run #2 finding)#476
jensholdgaard merged 4 commits into
mainfrom
rfc0031-byte-capped-push

Conversation

@jensholdgaard

Copy link
Copy Markdown
Owner

What

Run #2 (29162850605) got deep into the pipeline before dying at the Loki replay: a count-capped push (500 LogsData) encoded to 5.28 MB and hit Loki's stock 4 MiB internal gRPC cap (503 ResourceExhausted, permanently — the retry loop correctly gave up at its deadline). Count-capped batching is blind to heterogeneous batch sizes; kafka's fat batches blew the limit at ~200k/690k.

Fix: batch by encoded bytes (~3 MiB flush with 1 MiB headroom; per-ResourceLogs encoded_len estimate) with a 500-line secondary cap, flushing before an overflowing append so no push can exceed the cap. Adapting the pusher to Loki's stock limit is the anti-strawman direction — a real OTLP exporter batches under size limits too.

Run #2's positive findings (the pipeline works)

  • The generalized picker chose kafka / WARN (≥13) / 1 row on the real corpus — first try.
  • The Ourios half completed at 4.9 M-record scale: the 2.96 GB corpus mined into the registry-bearing store and the in-process query returned exactly the expected row.
  • The replay sustained ~200k batches before the size edge — rate limits and retries held.

After merge

Re-dispatch → run #3. The only unvalidated stretch left is the back half of the Loki replay + the at-scale equivalence + the report block.

🤖 Generated with Claude Code

jensholdgaard and others added 2 commits July 11, 2026 20:27
Run #2 (29162850605) reached 200k/690k batches before a count-capped
push (500 LogsData) encoded to 5.28 MB and hit Loki's stock 4 MiB
internal gRPC cap (503 ResourceExhausted, permanently — the retry loop
then correctly gave up at its deadline). Count-capped batching is blind
to heterogeneous batch sizes.

Batch by ENCODED BYTES (~3 MiB flush, 1 MiB headroom under the cap; the
per-ResourceLogs estimate slightly undercounts envelope framing) with a
500-line secondary cap. Flush BEFORE appending an overflowing line so no
push can exceed the cap. Adapting the pusher to Loki's stock limit is
the anti-strawman direction — a real OTLP exporter batches under size
limits too.

Also in run #2, positive findings: the generalized picker chose
kafka/WARN(>=13)/1 row on the real corpus, and the OURIOS HALF COMPLETED
AT 4.9M-RECORD SCALE (store build + in-process query returned exactly
the expected row).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jensholdgaard
jensholdgaard requested a review from Copilot July 11, 2026 18:29
@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@jensholdgaard, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 10 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: bca16f97-87fa-4ac6-b7ad-468299f32a4c

📥 Commits

Reviewing files that changed from the base of the PR and between 01069ad and 9c41936.

📒 Files selected for processing (1)
  • crates/ourios-bench/tests/rfc0031_comparative.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch rfc0031-byte-capped-push

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the RFC 0031 comparative benchmark’s Loki replay to batch OTLP pushes by estimated encoded protobuf bytes (instead of a fixed LogsData count) to stay under Loki’s stock 4 MiB internal gRPC message limit observed in run #2.

Changes:

  • Switch Loki ingestion batching from count-capped (500) to byte-capped flushing (~3 MiB target) with a 500-LogsData secondary cap.
  • Flush before appending an overflowing line to prevent oversized pushes.
Comments suppressed due to low confidence (1)

crates/ourios-bench/tests/rfc0031_comparative.rs:775

  • The final flush path should enforce the same max-encoded-size check as the mid-loop flush. Otherwise a regression (or an unexpectedly large final batch) can still hit Loki’s gRPC cap and trigger the long retry loop.
    if !pending.is_empty() {
        let payload = opentelemetry_proto::tonic::collector::logs::v1::ExportLogsServiceRequest {
            resource_logs: pending,
        }
        .encode_to_vec();
        push_otlp(http, base, payload).await;

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/ourios-bench/tests/rfc0031_comparative.rs
An at/over-4-MiB payload 503s permanently; burning the 120 s retry
deadline on it masks the cause. push_otlp now asserts the actual encoded
size up front, converting the batcher's byte estimate into a checked
guarantee.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

Comment thread crates/ourios-bench/tests/rfc0031_comparative.rs Outdated
Comment thread crates/ourios-bench/tests/rfc0031_comparative.rs
Copilot review: the estimate comment claimed undercounting (the +8
padding actually tracks framing closely — and push_otlp's assert is the
real guarantee); the progress log printed lines-read as 'batches
pushed'. Both now say what they mean, and the final request count
increments in the tail flush instead of a blind +1.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@jensholdgaard
jensholdgaard merged commit 045e40e into main Jul 11, 2026
26 checks passed
@jensholdgaard
jensholdgaard deleted the rfc0031-byte-capped-push branch July 11, 2026 18:50
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.

2 participants