datadog-agent icon indicating copy to clipboard operation
datadog-agent copied to clipboard

[USM] Improve loops in http2

Open amitslavin opened this issue 1 year ago • 1 comments

What does this PR do?

  • Improve our current Instructions count for both http2 plain and TLS by removing redundant use of #pragma unroll.
  • Maps each reason for #pragma unroll for future investigations.

Motivation

before the change:

  • usm/socket__http2_eos_parser: Stack Usage: 200 , Instructions Processed: 232584,
  • usm/uprobe__http2_tls_eos_parser: Stack Usage: 208 , Instructions Processed: 232812.

after the change:

  • usm/socket__http2_eos_parser: Stack Usage: 152 , Instructions Processed: 101808,
  • usm/uprobe__http2_tls_eos_parser: Stack Usage: 160, Instructions Processed: 106412.

Total improvement: Approximately - ~24% reduction in stack usage, ~56% reduction instructions count, for both socket__http2_eos_parser and uprobe__http2_tls_eos_parser

The tests were performed locally on 5.15.0-73-generic, ubuntu-22.

Additional Notes

Possible Drawbacks / Trade-offs

Describe how to test/QA your changes

amitslavin avatar Feb 14 '24 14:02 amitslavin

Bloop Bleep... Dogbot Here

Regression Detector Results

Run ID: 7b12774c-e82c-4d9d-8500-1ec1d389cba9 Baseline: ccb92fe1f697b32b2d02ffa474b3f0c6db447d59 Comparison: bed89297cf7ff63c7d1b54f8822866ef7cbcd1ce Total CPUs: 7

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 -0.41 [-6.99, +6.16]

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI
idle memory utilization +0.59 [+0.56, +0.63]
tcp_syslog_to_blackhole ingress throughput +0.59 [+0.53, +0.65]
process_agent_real_time_mode memory utilization +0.40 [+0.37, +0.44]
process_agent_standard_check_with_stats memory utilization +0.23 [+0.19, +0.27]
process_agent_standard_check memory utilization +0.22 [+0.18, +0.26]
trace_agent_json ingress throughput +0.03 [-0.01, +0.06]
file_tree memory utilization +0.01 [-0.07, +0.09]
uds_dogstatsd_to_api ingress throughput +0.00 [-0.00, +0.00]
tcp_dd_logs_filter_exclude ingress throughput +0.00 [-0.00, +0.00]
trace_agent_msgpack ingress throughput -0.02 [-0.02, -0.01]
otel_to_otel_logs ingress throughput -0.32 [-0.92, +0.29]
uds_dogstatsd_to_api_cpu % cpu utilization -0.39 [-1.81, +1.03]
file_to_blackhole % cpu utilization -0.41 [-6.99, +6.16]

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:

  1. Its estimated |Δ mean %| ≥ 5.00%, indicating the change is big enough to merit a closer look.

  2. 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.

  3. Its configuration does not mark it "erratic".

pr-commenter[bot] avatar Feb 14 '24 15:02 pr-commenter[bot]

Perhaps you could add some info to the PR description about why these pragmas are redundant? Is it because this decoder is only used on kernel versions supporting loops?

vitkyrka avatar May 09 '24 09:05 vitkyrka

We had the notion to bump the kernel limitation of http2 to 5.4 instead of 5.2 In 5.3 bounded loops introduced we means we could remove unroll from the code

guyarb avatar May 09 '24 10:05 guyarb