in_opentelemetry: reduce protobuf decode allocation churn#12089
Open
edsiper wants to merge 2 commits into
Open
in_opentelemetry: reduce protobuf decode allocation churn#12089edsiper wants to merge 2 commits into
edsiper wants to merge 2 commits into
Conversation
Use a CFL arena for protobuf log requests of at least 64 KiB. Keep protobuf-c allocation for smaller payloads. Arena creation failure also falls back to protobuf-c. Across 50 decodes of a 2,978,046-byte request: - task-clock fell 16.66%; - cycles fell 15.88%; - instructions fell 18.94%. Massif process peak was unchanged. Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe OpenTelemetry input plugin adds arena-backed protobuf decoding for large Logs payloads and matching cleanup. Integration tests cover large protobuf ingestion and rejection of invalid or oversized payloads. ChangesOpenTelemetry protobuf arena decoding
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
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.
Problem
Decoding a large OTLP protobuf logs request asks protobuf-c to allocate every
message, repeated field, string, and byte field independently. These objects
share the request lifetime, so individual heap allocations and frees add CPU
and allocator churn without providing useful lifetime granularity.
Change
arena.
setup on the latency-sensitive small-payload path.
decoded requests.
the 64 KiB boundary.
This is most beneficial for high-volume OTLP log ingestion with large batched
protobuf requests containing many records and nested attributes. JSON, metrics,
traces, and small protobuf log requests are unchanged.
Performance
Release build with GCC 13.3, pinned to CPU 2. The same 2,978,046-byte,
2,048-record request was decoded 50 times. Each
perf statvalue is the meanof five runs.
Massif measured the same 49,758,368-byte process peak before and after. Its
cumulative allocation-time proxy fell 0.59%. This optimization reduces CPU and
allocation-call churn; this workload does not demonstrate lower peak memory.
Verification
Passed 4/4.
The following focused cases passed 3/3 normally and 3/3 under strict Valgrind:
Commit-prefix validation passed for the full
master..HEADrange.Compatibility
There are no configuration or wire-format changes. The arena is local to one
decode operation and is not shared between requests or threads.
Summary by CodeRabbit
Bug Fixes
Tests