-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
pkg/trace/api: limit simultaneous otlp requests, do not drop payloads #23085
pkg/trace/api: limit simultaneous otlp requests, do not drop payloads #23085
Conversation
This commit causes the Trace Agent OTLP Receiver to not drop traces when the payload channel is full. This commit also limits the number of simultaneous RPC requests, forwarding the backpressure from the pipeline to the client, and limiting our memory to O(MaxConnections * MaxStreams * MaxPayloadSize) in the receiver, with MaxStreams being 1. This should improve the trace dropping situation without exploding memory as badly as having a large channel. By default, a gRPC server will allow practically unlimited concurrent RPC requests, spawning a goroutine for each. The routine will read and deserialize the payload before calling the handler. This means that our memory usage is not reasonably bounded, since we could be holding hundreds of payloads in memory waiting to be processed.
Bloop Bleep... Dogbot HereRegression Detector ResultsRun ID: c0508a00-2993-4501-bd7c-688aaba42bf2 Performance changes are noted in the perf column of each table:
Experiments with missing or malformed data
Usually, this warning means that there is no usable optimization goal data for that experiment, which could be a result of misconfiguration. No significant changes in experiment optimization goalsConfidence level: 90.00% There were no significant changes in experiment optimization goals at this confidence level and effect size tolerance.
|
perf | experiment | goal | Δ mean % | Δ mean % CI |
---|---|---|---|---|
➖ | file_to_blackhole | % cpu utilization | -1.98 | [-8.47, +4.52] |
Fine details of change detection per experiment
perf | experiment | goal | Δ mean % | Δ mean % CI |
---|---|---|---|---|
➖ | otel_to_otel_logs | ingress throughput | +1.38 | [+0.76, +2.00] |
➖ | process_agent_real_time_mode | memory utilization | +0.33 | [+0.29, +0.37] |
➖ | uds_dogstatsd_to_api_cpu | % cpu utilization | +0.27 | [-1.19, +1.72] |
➖ | idle | memory utilization | +0.07 | [+0.04, +0.10] |
➖ | tcp_syslog_to_blackhole | ingress throughput | +0.06 | [+0.00, +0.12] |
➖ | file_tree | memory utilization | +0.03 | [-0.06, +0.12] |
➖ | trace_agent_json | ingress throughput | +0.02 | [-0.02, +0.06] |
➖ | process_agent_standard_check | memory utilization | +0.02 | [-0.02, +0.06] |
➖ | tcp_dd_logs_filter_exclude | ingress throughput | +0.00 | [-0.00, +0.00] |
➖ | trace_agent_msgpack | ingress throughput | +0.00 | [-0.00, +0.00] |
➖ | uds_dogstatsd_to_api | ingress throughput | +0.00 | [-0.00, +0.00] |
➖ | process_agent_standard_check_with_stats | memory utilization | -0.40 | [-0.43, -0.37] |
➖ | file_to_blackhole | % cpu utilization | -1.98 | [-8.47, +4.52] |
Explanation
A regression test is an A/B test of target performance in a repeatable rig, where "performance" is measured as "comparison variant minus baseline variant" for an optimization goal (e.g., ingress throughput). Due to intrinsic variability in measuring that goal, we can only estimate its mean value for each experiment; we report uncertainty in that value as a 90.00% confidence interval denoted "Δ mean % CI".
For each experiment, we decide whether a change in performance is a "regression" -- a change worth investigating further -- if all of the following criteria are true:
-
Its estimated |Δ mean %| ≥ 5.00%, indicating the change is big enough to merit a closer look.
-
Its 90.00% confidence interval "Δ mean % CI" does not contain zero, indicating that if our statistical model is accurate, there is at least a 90.00% chance there is a difference in performance between baseline and comparison variants.
-
Its configuration does not mark it "erratic".
Re: regression detector, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small edit for consistency
releasenotes/notes/apm-otel-receiver-backpressure-40e301d75d00804d.yaml
Outdated
Show resolved
Hide resolved
/merge |
🚂 MergeQueue Pull request added to the queue. This build is going to start soon! (estimated merge in less than 49m) Use |
…804d.yaml Co-authored-by: Heston Hoffman <[email protected]>
❌ MergeQueue This PR is rejected because it was updated If you need support, contact us on Slack #ci-interfaces with those details! |
/merge |
🚂 MergeQueue Pull request added to the queue. This build is going to start soon! (estimated merge in less than 49m) Use |
…#23085) pkg/trace/api: limit simultaneous otlp requests, do not drop payloads Co-authored-by: dineshg13 <[email protected]> (cherry picked from commit a396d12)
…#23085) (#23151) [Backport 7.52.x] pkg/trace/api: limit simultaneous otlp requests, do not drop payloads Co-authored-by: knusbaum <[email protected]>
…#23085) pkg/trace/api: limit simultaneous otlp requests, do not drop payloads Co-authored-by: dineshg13 <[email protected]>
Updates all datadog dependencies to the psuedo version from the [otel/backport](https://github.com/DataDog/datadog-agent/tree/otel/backport) branch. Removes [blocking channel changes](DataDog/datadog-agent#23085) and associated changelog.
Updates all datadog dependencies to the psuedo version from the [otel/backport](https://github.com/DataDog/datadog-agent/tree/otel/backport) branch. Removes [blocking channel changes](DataDog/datadog-agent#23085) and associated changelog.
What does this PR do?
This commit causes the Trace Agent OTLP Receiver to not drop traces when the payload channel is full.
This commit also limits the number of simultaneous RPC requests, forwarding the backpressure from the pipeline to the client, and limiting our memory to O(MaxConnections * MaxStreams * MaxPayloadSize) in the receiver, with MaxStreams being 1.
Finally, it eliminates the trace buffer in the collector component exporter, preventing the core agent from buffering GiBs of traces under load.
All of these changes reduce trace drops while preventing uncontrolled memory growth.
Motivation
Previously, the OTLP Receiver in the Trace Agent dropped traces when the processor channel was full. This means that the receiver was dropping traces unnecessarily, and a better strategy is to block on the send. This will cause backpressure up through the otlp pipeline.
By default, a gRPC server will allow practically unlimited concurrent RPC requests, spawning a goroutine for each. The routine will read and deserialize the payload before calling the handler, which is now blocking.
This means that our memory usage is not reasonably bounded, since we could be holding hundreds of payloads in memory waiting to be processed. Limiting the number of concurrent RPC requests is required.
Finally, the backpressure goes to the core agent collector component. Here we need to remove the trace buffer to prevent GiBs of trace payloads from being buffered when it feels the backpressure from the Trace Agent.
Additional Notes
Possible Drawbacks / Trade-offs
Eliminating the trace buffer in the collector component could in theory result in higher trace loss in certain bursty scenarios. In practice, we don't see such scenarios and so this is a fair trade-off.
Describe how to test/QA your changes
We will use the new OTel load testing environment to exercise this change.
We should compare:
throughput (are traces being dropped)
memory usage (is memory usage better or worse)
See @knusbaum for details about more specifics regarding infrastructure.