datadog-agent
datadog-agent copied to clipboard
pkg/trace/api: create pool for traces
What does this PR do?
The decoder regularly allocates space for traces and then discards it. Reducing this should reduce garbage and GC pressure.
Motivation
Additional Notes
For this one, I was not able to make a Go Benchmark work. Instead, I'll attach this image from a profile showing significant reduction in allocations from a local test:
Possible Drawbacks / Trade-offs
Describe how to test/QA your changes
Benchmarks
Benchmark execution time: 2024-05-31 20:42:20
Comparing candidate commit c0a2592fc61ed3c85fbef8678d4de0979986d47f in PR branch knusbaum/pool-traces with baseline commit bba6f6d17eb5b0ca7549d63134f837533ce87562 in branch main.
Found 1 performance improvements and 0 performance regressions! Performance is the same for 1 metrics, 1 unstable metrics.
scenario:BenchmarkAgentTraceProcessing-24
- 🟩
allocated_mem[-1.907MB; -1.680MB] or [-45.647%; -40.214%]
The profile in the description was not normalized, and it doesn't appear that there's a huge difference. Need to look into this more.
Test changes on VM
Use this command from test-infra-definitions to manually test this PR changes on a VM:
inv create-vm --pipeline-id=35621324 --os-family=ubuntu
Codecov Report
Attention: Patch coverage is 73.09942% with 46 lines in your changes missing coverage. Please review.
Project coverage is 62.27%. Comparing base (
9f39b07) to head (c0a2592). Report is 1913 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #26205 +/- ##
===========================================
+ Coverage 45.17% 62.27% +17.09%
===========================================
Files 2346 242 -2104
Lines 270606 21085 -249521
===========================================
- Hits 122246 13130 -109116
+ Misses 138710 7394 -131316
+ Partials 9650 561 -9089
| Flag | Coverage Δ | |
|---|---|---|
| amzn_aarch64 | 62.64% <73.09%> (+16.64%) |
:arrow_up: |
| centos_x86_64 | 62.66% <73.09%> (+16.74%) |
:arrow_up: |
| ubuntu_aarch64 | 62.66% <73.09%> (+16.65%) |
:arrow_up: |
| ubuntu_x86_64 | 62.69% <73.09%> (+16.69%) |
:arrow_up: |
| windows_amd64 | 60.66% <73.09%> (+9.26%) |
:arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.