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

refactor for readibility

Open alexgallotta opened this issue 11 months ago • 2 comments

  • change read only vars to const
  • pull out methods to keep same abstraction level for readability
  • add debug log when DD_EXPERIMENTAL_ENABLE_PROXY is ignore for appsec proxy

alexgallotta avatar Feb 28 '24 18:02 alexgallotta

Serverless Benchmark Results

BenchmarkStartEndInvocation comparison between 3bdc4d5f770a8c5cda447784815eb24107a3647d and b4d454bb5295bd1b5db5c5cbed7b67b93d160884.

tl;dr
  1. Skim down the vs base column in each chart. If there is a ~, then there was no statistically significant change to the benchmark. Otherwise, ensure the estimated percent change is either negative or very small.

  2. The last row of each chart is the geomean. Ensure this percentage is either negative or very small.

What is this benchmarking?

The BenchmarkStartEndInvocation compares the amount of time it takes to call the start-invocation and end-invocation endpoints. For universal instrumentation languages (Dotnet, Golang, Java, Ruby), this represents the majority of the duration overhead added by our tracing layer.

The benchmark is run using a large variety of lambda request payloads. In the charts below, there is one row for each event payload type.

How do I interpret these charts?

The charts below comes from benchstat. They represent the statistical change in duration (sec/op), memory overhead (B/op), and allocations (allocs/op).

The benchstat docs explain how to interpret these charts.

Before the comparison table, we see common file-level configuration. If there are benchmarks with different configuration (for example, from different packages), benchstat will print separate tables for each configuration.

The table then compares the two input files for each benchmark. It shows the median and 95% confidence interval summaries for each benchmark before and after the change, and an A/B comparison under "vs base". ... The p-value measures how likely it is that any differences were due to random chance (i.e., noise). The "~" means benchstat did not detect a statistically significant difference between the two inputs. ...

Note that "statistically significant" is not the same as "large": with enough low-noise data, even very small changes can be distinguished from noise and considered statistically significant. It is, of course, generally easier to distinguish large changes from noise.

Finally, the last row of the table shows the geometric mean of each column, giving an overall picture of how the benchmarks changed. Proportional changes in the geomean reflect proportional changes in the benchmarks. For example, given n benchmarks, if sec/op for one of them increases by a factor of 2, then the sec/op geomean will increase by a factor of ⁿ√2.

Benchmark stats
goos: linux
goarch: amd64
pkg: github.com/DataDog/datadog-agent/pkg/serverless/daemon
cpu: AMD EPYC 7763 64-Core Processor                
                                      │ baseline/benchmark.log │        current/benchmark.log        │
                                      │         sec/op         │    sec/op     vs base               │
api-gateway-appsec.json                            87.92µ ± 4%    92.63µ ± 6%  +5.35% (p=0.003 n=10)
api-gateway-kong-appsec.json                       65.77µ ± 3%    71.19µ ± 1%  +8.24% (p=0.000 n=10)
api-gateway-kong.json                              68.25µ ± 3%    68.88µ ± 1%       ~ (p=0.089 n=10)
api-gateway-non-proxy-async.json                   105.0µ ± 2%    109.0µ ± 1%  +3.74% (p=0.000 n=10)
api-gateway-non-proxy.json                         104.1µ ± 3%    108.3µ ± 1%  +3.98% (p=0.000 n=10)
api-gateway-websocket-connect.json                 68.53µ ± 1%    70.40µ ± 1%  +2.73% (p=0.000 n=10)
api-gateway-websocket-default.json                 61.58µ ± 3%    63.62µ ± 1%  +3.31% (p=0.000 n=10)
api-gateway-websocket-disconnect.json              62.41µ ± 2%    64.49µ ± 3%  +3.33% (p=0.000 n=10)
api-gateway.json                                   116.2µ ± 1%    119.0µ ± 1%  +2.40% (p=0.000 n=10)
application-load-balancer.json                     63.16µ ± 2%    64.24µ ± 1%  +1.72% (p=0.003 n=10)
cloudfront.json                                    48.82µ ± 3%    49.54µ ± 4%       ~ (p=0.089 n=10)
cloudwatch-events.json                             39.00µ ± 1%    39.08µ ± 1%       ~ (p=0.869 n=10)
cloudwatch-logs.json                               66.36µ ± 2%    67.35µ ± 2%  +1.49% (p=0.043 n=10)
custom.json                                        30.62µ ± 3%    31.45µ ± 1%  +2.71% (p=0.009 n=10)
dynamodb.json                                      96.09µ ± 1%    97.44µ ± 1%  +1.40% (p=0.000 n=10)
empty.json                                         29.47µ ± 2%    29.88µ ± 1%  +1.39% (p=0.023 n=10)
eventbridge-custom.json                            42.46µ ± 4%    43.32µ ± 2%  +2.04% (p=0.009 n=10)
http-api.json                                      72.98µ ± 2%    74.86µ ± 1%  +2.59% (p=0.000 n=10)
kinesis-batch.json                                 72.53µ ± 2%    74.20µ ± 2%  +2.31% (p=0.019 n=10)
kinesis.json                                       54.11µ ± 2%    56.23µ ± 2%  +3.91% (p=0.000 n=10)
s3.json                                            60.19µ ± 2%    62.47µ ± 2%  +3.79% (p=0.000 n=10)
sns-batch.json                                     93.97µ ± 3%    94.94µ ± 1%  +1.03% (p=0.023 n=10)
sns.json                                           64.99µ ± 2%    67.55µ ± 2%  +3.93% (p=0.000 n=10)
snssqs.json                                        106.6µ ± 1%    110.8µ ± 1%  +3.92% (p=0.000 n=10)
snssqs_no_dd_context.json                          99.49µ ± 1%   104.91µ ± 1%  +5.46% (p=0.000 n=10)
sqs-aws-header.json                                56.05µ ± 4%    57.30µ ± 2%  +2.22% (p=0.000 n=10)
sqs-batch.json                                     93.20µ ± 2%    98.61µ ± 2%  +5.80% (p=0.000 n=10)
sqs.json                                           66.86µ ± 1%    72.75µ ± 4%  +8.81% (p=0.000 n=10)
sqs_no_dd_context.json                             61.18µ ± 2%    64.06µ ± 2%  +4.71% (p=0.000 n=10)
geomean                                            67.06µ         69.24µ       +3.25%

                                      │ baseline/benchmark.log │        current/benchmark.log        │
                                      │          B/op          │     B/op      vs base               │
api-gateway-appsec.json                           36.96Ki ± 0%   36.96Ki ± 0%       ~ (p=0.324 n=10)
api-gateway-kong-appsec.json                      26.62Ki ± 0%   26.63Ki ± 0%       ~ (p=0.492 n=10)
api-gateway-kong.json                             24.12Ki ± 0%   24.11Ki ± 0%       ~ (p=0.541 n=10)
api-gateway-non-proxy-async.json                  47.77Ki ± 0%   47.77Ki ± 0%       ~ (p=0.590 n=10)
api-gateway-non-proxy.json                        46.97Ki ± 0%   46.98Ki ± 0%       ~ (p=0.315 n=10)
api-gateway-websocket-connect.json                25.20Ki ± 0%   25.20Ki ± 0%       ~ (p=0.896 n=10)
api-gateway-websocket-default.json                21.10Ki ± 0%   21.10Ki ± 0%       ~ (p=0.697 n=10)
api-gateway-websocket-disconnect.json             20.88Ki ± 0%   20.88Ki ± 0%       ~ (p=0.517 n=10)
api-gateway.json                                  49.29Ki ± 0%   49.29Ki ± 0%       ~ (p=0.565 n=10)
application-load-balancer.json                    22.07Ki ± 0%   22.07Ki ± 0%       ~ (p=0.897 n=10)
cloudfront.json                                   17.40Ki ± 0%   17.40Ki ± 0%       ~ (p=0.183 n=10)
cloudwatch-events.json                            11.46Ki ± 0%   11.44Ki ± 0%  -0.14% (p=0.002 n=10)
cloudwatch-logs.json                              53.11Ki ± 0%   53.12Ki ± 0%       ~ (p=0.159 n=10)
custom.json                                       9.479Ki ± 0%   9.474Ki ± 0%       ~ (p=0.616 n=10)
dynamodb.json                                     40.42Ki ± 0%   40.41Ki ± 0%       ~ (p=0.987 n=10)
empty.json                                        9.033Ki ± 0%   9.024Ki ± 0%       ~ (p=0.565 n=10)
eventbridge-custom.json                           13.16Ki ± 0%   13.16Ki ± 0%       ~ (p=0.725 n=10)
http-api.json                                     23.46Ki ± 0%   23.42Ki ± 0%       ~ (p=0.362 n=10)
kinesis-batch.json                                26.76Ki ± 0%   26.79Ki ± 0%       ~ (p=0.190 n=10)
kinesis.json                                      17.55Ki ± 0%   17.57Ki ± 0%       ~ (p=0.393 n=10)
s3.json                                           20.08Ki ± 0%   20.09Ki ± 0%       ~ (p=0.447 n=10)
sns-batch.json                                    38.42Ki ± 0%   38.40Ki ± 0%       ~ (p=0.753 n=10)
sns.json                                          23.74Ki ± 0%   23.74Ki ± 0%       ~ (p=0.953 n=10)
snssqs.json                                       49.33Ki ± 0%   49.38Ki ± 0%       ~ (p=0.086 n=10)
snssqs_no_dd_context.json                         44.55Ki ± 0%   44.60Ki ± 0%       ~ (p=0.052 n=10)
sqs-aws-header.json                               18.60Ki ± 0%   18.65Ki ± 0%       ~ (p=0.105 n=10)
sqs-batch.json                                    41.36Ki ± 0%   41.41Ki ± 0%  +0.14% (p=0.009 n=10)
sqs.json                                          25.30Ki ± 0%   25.31Ki ± 0%       ~ (p=0.754 n=10)
sqs_no_dd_context.json                            20.44Ki ± 0%   20.47Ki ± 0%       ~ (p=0.218 n=10)
geomean                                           25.39Ki        25.40Ki       +0.03%

                                      │ baseline/benchmark.log │        current/benchmark.log        │
                                      │       allocs/op        │ allocs/op   vs base                 │
api-gateway-appsec.json                             628.0 ± 0%   629.0 ± 0%       ~ (p=0.656 n=10)
api-gateway-kong-appsec.json                        487.0 ± 0%   487.0 ± 0%       ~ (p=1.000 n=10) ¹
api-gateway-kong.json                               465.0 ± 0%   465.0 ± 0%       ~ (p=1.000 n=10) ¹
api-gateway-non-proxy-async.json                    724.0 ± 0%   724.0 ± 0%       ~ (p=1.000 n=10)
api-gateway-non-proxy.json                          715.0 ± 0%   715.0 ± 0%       ~ (p=1.000 n=10)
api-gateway-websocket-connect.json                  452.0 ± 0%   452.0 ± 0%       ~ (p=1.000 n=10) ¹
api-gateway-websocket-default.json                  378.0 ± 0%   378.0 ± 0%       ~ (p=1.000 n=10) ¹
api-gateway-websocket-disconnect.json               368.0 ± 0%   368.0 ± 0%       ~ (p=1.000 n=10)
api-gateway.json                                    789.0 ± 0%   789.0 ± 0%       ~ (p=1.000 n=10)
application-load-balancer.json                      351.0 ± 0%   351.0 ± 0%       ~ (p=1.000 n=10)
cloudfront.json                                     282.0 ± 0%   283.0 ± 0%       ~ (p=0.179 n=10)
cloudwatch-events.json                              219.0 ± 0%   219.0 ± 0%       ~ (p=1.000 n=10)
cloudwatch-logs.json                                214.0 ± 0%   214.0 ± 0%       ~ (p=1.000 n=10)
custom.json                                         167.0 ± 0%   167.0 ± 0%       ~ (p=1.000 n=10) ¹
dynamodb.json                                       588.0 ± 0%   588.0 ± 0%       ~ (p=0.628 n=10)
empty.json                                          158.0 ± 1%   158.0 ± 0%       ~ (p=0.303 n=10)
eventbridge-custom.json                             252.5 ± 0%   252.5 ± 0%       ~ (p=1.000 n=10)
http-api.json                                       431.0 ± 0%   430.5 ± 0%       ~ (p=0.082 n=10)
kinesis-batch.json                                  389.0 ± 0%   390.0 ± 0%       ~ (p=0.593 n=10)
kinesis.json                                        284.0 ± 0%   284.0 ± 0%       ~ (p=0.777 n=10)
s3.json                                             356.5 ± 0%   357.0 ± 0%       ~ (p=0.584 n=10)
sns-batch.json                                      454.0 ± 0%   454.0 ± 0%       ~ (p=0.377 n=10)
sns.json                                            322.0 ± 0%   322.0 ± 0%       ~ (p=1.000 n=10)
snssqs.json                                         423.0 ± 0%   423.5 ± 0%       ~ (p=0.097 n=10)
snssqs_no_dd_context.json                           398.0 ± 0%   399.0 ± 0%       ~ (p=0.070 n=10)
sqs-aws-header.json                                 272.0 ± 0%   273.0 ± 0%       ~ (p=0.225 n=10)
sqs-batch.json                                      502.0 ± 0%   503.0 ± 0%  +0.20% (p=0.005 n=10)
sqs.json                                            350.0 ± 1%   350.0 ± 1%       ~ (p=0.917 n=10)
sqs_no_dd_context.json                              323.5 ± 0%   324.0 ± 0%       ~ (p=0.225 n=10)
geomean                                             374.6        374.8       +0.06%
¹ all samples are equal

github-actions[bot] avatar Feb 28 '24 18:02 github-actions[bot]

Bloop Bleep... Dogbot Here

Regression Detector Results

Run ID: 2fe7c384-2112-4fb3-8a19-ace9993309e6 Baseline: 3bdc4d5f770a8c5cda447784815eb24107a3647d Comparison: fd13d1f212f9a962f40eb7faaef874950c23325d 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

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.10 [-6.44, +6.64]

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI
uds_dogstatsd_to_api_cpu % cpu utilization +0.63 [-0.80, +2.05]
process_agent_standard_check_with_stats memory utilization +0.19 [+0.16, +0.22]
file_to_blackhole % cpu utilization +0.10 [-6.44, +6.64]
file_tree memory utilization +0.05 [-0.00, +0.11]
process_agent_standard_check memory utilization +0.02 [-0.02, +0.06]
trace_agent_msgpack ingress throughput +0.00 [-0.00, +0.01]
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_json ingress throughput +0.00 [-0.01, +0.01]
tcp_syslog_to_blackhole ingress throughput -0.05 [-0.10, +0.01]
process_agent_real_time_mode memory utilization -0.15 [-0.18, -0.11]
idle memory utilization -0.23 [-0.26, -0.19]
otel_to_otel_logs ingress throughput -0.65 [-1.28, -0.03]

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 28 '24 19:02 pr-commenter[bot]