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

[NPM-3137] Rollup connection ephemeral ports

Open hmahmood opened this issue 1 year ago • 6 comments

What does this PR do?

Implements "rolling up" connections by dropping ephemeral ports. This is done during connection aggregation when reporting connections from the system-probe. More details here.

There is a new config, network_config.enable_connection_rollup that is set to false by default.

A version of the LocalResolver has been introduced for local resolution in the system-probe if rollups are enabled. This is essential in order to not loose container resolution during rollups.

The benefits are primarily in the reporting path since we are now reporting fewer connection objects. This PR does not change how we store connections in between connections checks, leaving that for subsequent PRs; this is primarily due to it not being clear if rollups can be done in these code paths without impacting other essentials like local resolution.

Testing with the tcp load test on test clusters: https://datadoghq.atlassian.net/wiki/spaces/NET/pages/3522791502/Connection+Rollups+Performance+Testing#Results

Avg CPU change: -28% system-probe avg k8s CPU Usage by namespace (autosmoothed)

Avg working set change: -26% system-probe working set

Avg payload size change: -98.7% (note: this is very dramatic due to the nature of the test) image

Motivation

Use less memory for storing and reporting connections. This PR only has an impact in the reporting path, where the number of connections reported can be dramatically reduced by these rollups.

Additional Notes

Possible Drawbacks / Trade-offs

Describe how to test/QA your changes

Reviewer's Checklist

  • [x] 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.
  • [x] A release note has been added or the changelog/no-changelog label has been applied.
  • [x] Changed code has automated tests for its functionality.
  • [x] Adequate QA/testing plan information is provided if the qa/skip-qa label is not applied.
  • [x] 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.
  • [x] If applicable, the need-change/operator and need-change/helm labels have been applied.
  • [x] If applicable, the k8s/<min-version> label, indicating the lowest Kubernetes version compatible with this feature.
  • [ ] If applicable, the config template has been updated.

hmahmood avatar Aug 14 '23 22:08 hmahmood

Bloop Bleep... Dogbot Here

Regression Detector Results

Run ID: 5a1b78ff-4ec9-47b2-bcb5-54bc35e37307 Baseline: c7b1b2024b8fa779dcb8d21d5d227210a8af95cb Comparison: e9b2797b84bba7daa6986feb7bfb3de618d1bf26

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

Experiments with missing or malformed data

  • basic_py_check

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 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.31 [-6.86, +6.24]

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI
uds_dogstatsd_to_api_cpu % cpu utilization +0.93 [-0.50, +2.36]
process_agent_standard_check_with_stats memory utilization +0.70 [+0.67, +0.74]
idle memory utilization +0.70 [+0.67, +0.74]
process_agent_real_time_mode memory utilization +0.44 [+0.41, +0.48]
process_agent_standard_check memory utilization +0.17 [+0.14, +0.21]
file_tree memory utilization +0.15 [+0.08, +0.22]
trace_agent_json ingress throughput +0.03 [+0.00, +0.07]
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.03, -0.00]
file_to_blackhole % cpu utilization -0.31 [-6.86, +6.24]
tcp_syslog_to_blackhole ingress throughput -0.56 [-0.61, -0.50]
otel_to_otel_logs ingress throughput -1.06 [-1.67, -0.46]

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 Aug 14 '23 23:08 pr-commenter[bot]

Go Package Import Differences

Baseline: b057e0b92a13f07c9bd9d2b9bc930abd68fa66eb Comparison: 170a7402dba9197698ea4e00501892c82900f7d5

binaryosarchchange
system-probewindowsamd64
+2, -0
+go4.org/intern
+go4.org/unsafe/assume-no-moving-gc

cit-pr-commenter[bot] avatar Jan 08 '24 23:01 cit-pr-commenter[bot]

how did this end up performing in oddish-c?

akarpz avatar Mar 04 '24 20:03 akarpz

how did this end up performing in oddish-c?

@akarpz see https://datadoghq.atlassian.net/wiki/spaces/NET/pages/3522791502/Connection+Rollups+Performance+Testing#oddish-c

hmahmood avatar Mar 05 '24 20:03 hmahmood

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=31182918 --os-family=ubuntu

pr-commenter[bot] avatar Mar 14 '24 22:03 pr-commenter[bot]

Regression Detector

Regression Detector Results

Run ID: 9221c406-dea5-4508-9eef-9c4a442e6b30 Baseline: b057e0b92a13f07c9bd9d2b9bc930abd68fa66eb Comparison: 170a7402dba9197698ea4e00501892c82900f7d5

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 +2.07 [-4.28, +8.43]

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI
file_to_blackhole % cpu utilization +2.07 [-4.28, +8.43]
pycheck_1000_100byte_tags % cpu utilization +1.30 [-3.61, +6.21]
basic_py_check % cpu utilization +0.15 [-2.15, +2.46]
idle memory utilization +0.08 [+0.04, +0.12]
trace_agent_json ingress throughput +0.03 [+0.00, +0.05]
uds_dogstatsd_to_api ingress throughput +0.00 [-0.20, +0.20]
uds_dogstatsd_to_api_cpu % cpu utilization -0.00 [-2.90, +2.90]
otel_to_otel_logs ingress throughput -0.01 [-0.45, +0.42]
tcp_dd_logs_filter_exclude ingress throughput -0.01 [-0.04, +0.02]
trace_agent_msgpack ingress throughput -0.02 [-0.02, -0.01]
process_agent_standard_check memory utilization -0.11 [-0.17, -0.05]
process_agent_standard_check_with_stats memory utilization -0.13 [-0.18, -0.08]
process_agent_real_time_mode memory utilization -0.16 [-0.20, -0.12]
file_tree memory utilization -0.78 [-0.89, -0.67]
tcp_syslog_to_blackhole ingress throughput -0.92 [-1.00, -0.83]

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 Mar 14 '24 22:03 pr-commenter[bot]

/merge

hmahmood avatar Apr 01 '24 14:04 hmahmood

:steam_locomotive: MergeQueue

Pull request added to the queue.

There are 2 builds ahead! (estimated merge in less than 28m)

Use /merge -c to cancel this operation!

dd-devflow[bot] avatar Apr 01 '24 14:04 dd-devflow[bot]

/merge -c

hmahmood avatar Apr 01 '24 14:04 hmahmood

:warning: MergeQueue

This merge request build was cancelled

If you need support, contact us on Slack #ci-interfaces!

dd-devflow[bot] avatar Apr 01 '24 14:04 dd-devflow[bot]

/merge

hmahmood avatar Apr 01 '24 14:04 hmahmood

:steam_locomotive: MergeQueue

This merge request is not mergeable yet, because of pending checks/missing approvals. It will be added to the queue as soon as checks pass and/or get approvals. Note: if you pushed new commits since the last approval, you may need additional approval. You can remove it from the waiting list with /remove command.

Use /merge -c to cancel this operation!

dd-devflow[bot] avatar Apr 01 '24 14:04 dd-devflow[bot]

:steam_locomotive: MergeQueue

Added to the queue.

This build is next! (estimated merge in less than 27m)

Use /merge -c to cancel this operation!

dd-devflow[bot] avatar Apr 01 '24 16:04 dd-devflow[bot]

:x: MergeQueue

Build pipeline failed for 94856b4

You should have a look at the pipeline and see if the build failed because of your changes or not. When you are ready, re-add your pull request to the queue!

⚠️ Do NOT retry failed jobs directly.

They were executed on a temporary branch created by the merge queue. If you retry them, they are going to fail because the branch no longer exists.

Details

List of failed jobs:

Go to failed Gitlab pipeline.

If you need support, contact us on Slack #ci-interfaces with those details!

dd-devflow[bot] avatar Apr 01 '24 16:04 dd-devflow[bot]

/merge

hmahmood avatar Apr 02 '24 21:04 hmahmood

:steam_locomotive: MergeQueue

Pull request added to the queue.

This build is going to start soon! (estimated merge in less than 27m)

Use /merge -c to cancel this operation!

dd-devflow[bot] avatar Apr 02 '24 21:04 dd-devflow[bot]