datadog-agent
datadog-agent copied to clipboard
[system-probe] Use Ringbuffers when supported on NPM
What does this PR do?
Migrates usage of perfbuffer
in NPM eBPF code to ringbuffer
where supported (introduced in kernel 5.8
). On the oldest kernels we support (namely 4.4 and slightly after) the function call to flush to the ringbuffer in kernelspace doesn't exist yet, so we use an instruction patcher to remove the call and allow the program to start. Additionally, this PR adds a config (true by default) that users can use to enable/disable ringbuffers on NPM.
Motivation
https://datadoghq.atlassian.net/browse/NPM-831
Additional Notes
Performance Testing:
Update: Tested this again using the latest changes and with the USM HTTP test, which seemed to put more load on system-probe than the TCP load test. Results were essentially flat between main and this branch. Max/avg CPU & memory graphs provided below.
Average CPU:
Max CPU:
Average Memory:
Average:
Original (outdated) Test
Results:
- Average CPU usage down ~4%
- Max CPU usage down ~4%
- Average Memory down ~7%
- Max Memory down ~9%
Possible Drawbacks / Trade-offs
Describe how to test/QA your changes
Reviewer's Checklist
- [ ] If known, an appropriate milestone has been selected; otherwise the
Triage
milestone is set. - [ ] Use the
major_change
label if your change either has a major impact on the code base, is impacting multiple teams or is changing important well-established internals of the Agent. This label will be use during QA to make sure each team pay extra attention to the changed behavior. For any customer facing change use a releasenote. - [ ] A release note has been added or the
changelog/no-changelog
label has been applied. - [ ] Changed code has automated tests for its functionality.
- [ ] Adequate QA/testing plan information is provided if the
qa/skip-qa
label is not applied. - [ ] At least one
team/..
label has been applied, indicating the team(s) that should QA this change. - [ ] If applicable, docs team has been notified or an issue has been opened on the documentation repo.
- [ ] If applicable, the
need-change/operator
andneed-change/helm
labels have been applied. - [ ] If applicable, the
k8s/<min-version>
label, indicating the lowest Kubernetes version compatible with this feature. - [ ] If applicable, the config template has been updated.
Bloop Bleep... Dogbot Here
Regression Detector Results
Run ID: e8874779-88d4-41d8-80f5-771edaa6067d Baseline: b4f0a172d309dc5b7689bc9674e0487e4fd0cf1b Comparison: e1d77292a6bc50d680a0d93ef7f7d93291fc6761
Performance changes are noted in the perf column of each table:
- ✅ = significantly better comparison variant performance
- ❌ = significantly worse comparison variant performance
- ➖ = no significant change in performance
No significant changes in experiment optimization goals
Confidence level: 90.00% Effect size tolerance: |Δ mean %| ≥ 5.00%
There were no significant changes in experiment optimization goals at this confidence level and effect size tolerance.
Experiments ignored for regressions
Regressions in experiments with settings containing erratic: true
are ignored.
perf | experiment | goal | Δ mean % | Δ mean % CI |
---|---|---|---|---|
➖ | file_to_blackhole | % cpu utilization | -1.32 | [-7.61, +4.97] |
Fine details of change detection per experiment
perf | experiment | goal | Δ mean % | Δ mean % CI |
---|---|---|---|---|
➖ | otel_to_otel_logs | ingress throughput | +1.53 | [+0.89, +2.18] |
➖ | basic_py_check | % cpu utilization | +0.12 | [-2.40, +2.64] |
➖ | tcp_syslog_to_blackhole | ingress throughput | +0.08 | [+0.03, +0.14] |
➖ | uds_dogstatsd_to_api_cpu | % cpu utilization | +0.06 | [-1.50, +1.62] |
➖ | trace_agent_json | ingress throughput | +0.00 | [-0.01, +0.02] |
➖ | tcp_dd_logs_filter_exclude | ingress throughput | +0.00 | [-0.00, +0.00] |
➖ | uds_dogstatsd_to_api | ingress throughput | +0.00 | [-0.00, +0.00] |
➖ | trace_agent_msgpack | ingress throughput | -0.00 | [-0.00, +0.00] |
➖ | file_tree | memory utilization | -0.00 | [-0.10, +0.09] |
➖ | process_agent_standard_check | memory utilization | -0.21 | [-0.24, -0.18] |
➖ | idle | memory utilization | -0.26 | [-0.29, -0.23] |
➖ | process_agent_real_time_mode | memory utilization | -0.29 | [-0.32, -0.26] |
➖ | process_agent_standard_check_with_stats | memory utilization | -0.71 | [-0.74, -0.68] |
➖ | file_to_blackhole | % cpu utilization | -1.32 | [-7.61, +4.97] |
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".
This change was tested in system-probe-test-environments using the tcp-load-test. Initial results showed:
Average CPU usage up ~27% Max CPU usage up ~42%
That seems like a hard blocker for the PR If the new change makes the agent's/system-probe's performance much worse, then I don't see a reason to continue with the PR.
Do you know what's the breakdown for the additions using the profiler?
@guyarb I think there was an issue in the load test environment. I'll update the graphs in the description with the new results
Go Package Import Differences
Baseline: 0711dd6b9789e763b45707bf9a8a5261d578d738 Comparison: e1d77292a6bc50d680a0d93ef7f7d93291fc6761
binary | os | arch | change |
---|---|---|---|
system-probe | linux | amd64 | +1, -0
+github.com/DataDog/datadog-agent/pkg/network/tracer/connection/util
|
system-probe | linux | arm64 | +1, -0
+github.com/DataDog/datadog-agent/pkg/network/tracer/connection/util
|
system-probe | windows | amd64 | +16, -0
+debug/dwarf
+debug/elf
+github.com/cilium/ebpf
+github.com/cilium/ebpf/asm
+github.com/cilium/ebpf/btf
+github.com/cilium/ebpf/features
+github.com/cilium/ebpf/internal
+github.com/cilium/ebpf/internal/kconfig
+github.com/cilium/ebpf/internal/sys
+github.com/cilium/ebpf/internal/sysenc
+github.com/cilium/ebpf/internal/tracefs
+github.com/cilium/ebpf/internal/unix
+go/format
+go/printer
+internal/zstd
+maps
|
@guyarb this has not been tested on staging. I'll run an image on oddish-c
today
@guyarb I tested this on staging overnight on golurk
since you had an image on oddish-c
. It looks good to me 👍
/merge
:steam_locomotive: MergeQueue
Pull request added to the queue.
This build is going to start soon! (estimated merge in less than 28m)
Use /merge -c
to cancel this operation!