fix(bench): RFC 0031 — byte-capped Loki push batching (run #2 finding) - #476
Conversation
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>
|
Warning Review limit reached
Next review available in: 10 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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-
LogsDatasecondary 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.
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 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>
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-
ResourceLogsencoded_lenestimate) 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)
kafka/ WARN (≥13) / 1 row on the real corpus — first try.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