Skip to content

enhancement(io): reduce binary size by reducing monomorphization around HTTP client/server types#1217

Merged
tobz merged 1 commit into
mainfrom
tobz/unify-body-type-http-reduce-code-size
Mar 6, 2026
Merged

enhancement(io): reduce binary size by reducing monomorphization around HTTP client/server types#1217
tobz merged 1 commit into
mainfrom
tobz/unify-body-type-http-reduce-code-size

Conversation

@tobz
Copy link
Copy Markdown
Member

@tobz tobz commented Feb 26, 2026

Summary

This PR reduces some of the monomorphization around our various usages of HttpClient.

This is mostly in the form of switching to axum's BoxBody instead of separate concrete types, just to reduce the generated code. We've only done it in non-performance-critical areas so the boxing shouldn't really matter at all.

Change Type

  • Bug fix
  • New feature
  • Non-functional (chore, refactoring, docs)
  • Performance

How did you test this PR?

Existing tests.

References

AGTMETRICS-400

@tobz tobz requested a review from a team as a code owner February 26, 2026 19:46
@tobz tobz added the type/experiment A change that is still currently being worked on or tested to prove viability. label Feb 26, 2026
@dd-octo-sts dd-octo-sts Bot added area/io General I/O and networking. area/components Sources, transforms, and destinations. destination/prometheus Prometheus Scrape destination. labels Feb 26, 2026
@pr-commenter
Copy link
Copy Markdown

pr-commenter Bot commented Feb 26, 2026

Binary Size Analysis (Agent Data Plane)

Target: ae08e63 (baseline) vs cbcff87 (comparison) diff
Analysis Type: Stripped binaries (debug symbols excluded)
Baseline Size: 27.29 MiB
Comparison Size: 27.06 MiB
Size Change: -237.07 KiB (-0.85%)
Pass/Fail Threshold: +5%
Result: PASSED ✅

Changes by Module

Module File Size Symbols
hyper_util -71.66 KiB 105
core -51.43 KiB 8158
saluki_common::task::instrument +32.34 KiB 74
memory_accounting::allocator::Tracked -31.64 KiB 2
tokio_rustls -23.71 KiB 28
futures_util -19.66 KiB 70
hyper -18.19 KiB 335
[sections] -15.18 KiB 7
hyper_http_proxy -12.76 KiB 26
tower -11.83 KiB 218
saluki_components::forwarders::datadog -11.28 KiB 22
agent_data_plane::internal::remote_agent -10.82 KiB 62
saluki_io::net::client +8.30 KiB 38
h2 -8.11 KiB 326
http +7.78 KiB 303
tokio -7.40 KiB 2137
anyhow +5.44 KiB 1222
tracing_core +4.49 KiB 403
regex_automata +4.19 KiB 12
hashbrown -4.11 KiB 274

Detailed Symbol Changes

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  [NEW] +1.79Mi  [NEW] +1.79Mi    std::thread::local::LocalKey<T>::with::h6c9a8fa0b613775b
  [NEW]  +113Ki  [NEW]  +113Ki    agent_data_plane::cli::run::create_topology::_{{closure}}::h2ba97c4b54b0c30b
  [NEW] +84.5Ki  [NEW] +84.4Ki    agent_data_plane::internal::control_plane::spawn_control_plane::_{{closure}}::h23810f4dc340e6f1
  [NEW] +64.2Ki  [NEW] +64.0Ki    saluki_components::common::datadog::io::run_endpoint_io_loop::_{{closure}}::h08fc84c201eab0a3
  [NEW] +57.9Ki  [NEW] +57.7Ki    agent_data_plane::cli::run::handle_run_command::_{{closure}}::h517a19a4b350019e
  [NEW] +49.0Ki  [NEW] +48.9Ki    saluki_app::bootstrap::AppBootstrapper::bootstrap::_{{closure}}::h7b5b0f2785656dcb
  [NEW] +46.4Ki  [NEW] +46.3Ki    h2::proto::connection::Connection<T,P,B>::poll::h722d9ba49acb2559
  [NEW] +46.1Ki  [NEW] +45.9Ki    _<saluki_components::forwarders::otlp::OtlpForwarder as saluki_core::components::forwarders::Forwarder>::run::_{{closure}}::h16dd847b7336eb06
  [NEW] +45.8Ki  [NEW] +45.6Ki    _<saluki_components::destinations::prometheus::Prometheus as saluki_core::components::destinations::Destination>::run::_{{closure}}::h35604ad415f05c97
  [NEW] +44.4Ki  [NEW] +44.2Ki    _<saluki_components::transforms::aggregate::Aggregate as saluki_core::components::transforms::Transform>::run::_{{closure}}::ha4a67ee5b1751c11
  [NEW] +44.1Ki  [NEW] +44.0Ki    saluki_env::workload::providers::remote_agent::RemoteAgentWorkloadProvider::from_configuration::_{{closure}}::h86e543c374450f5e
  [DEL] -44.4Ki  [DEL] -44.2Ki    _<saluki_components::transforms::aggregate::Aggregate as saluki_core::components::transforms::Transform>::run::_{{closure}}::ha29366b6eeca130c
  [DEL] -45.8Ki  [DEL] -45.6Ki    _<saluki_components::destinations::prometheus::Prometheus as saluki_core::components::destinations::Destination>::run::_{{closure}}::h5af8497790b0e5a6
  [DEL] -46.1Ki  [DEL] -45.9Ki    _<saluki_components::forwarders::otlp::OtlpForwarder as saluki_core::components::forwarders::Forwarder>::run::_{{closure}}::h199692a5443d8e80
  [DEL] -48.9Ki  [DEL] -48.8Ki    saluki_app::bootstrap::AppBootstrapper::bootstrap::_{{closure}}::h4ed2fbccacefa396
  [DEL] -57.8Ki  [DEL] -57.7Ki    agent_data_plane::cli::run::handle_run_command::_{{closure}}::hd0c53bb9a80fae8f
  [DEL] -64.1Ki  [DEL] -63.9Ki    saluki_components::common::datadog::io::run_endpoint_io_loop::_{{closure}}::he8167230eb298c36
  [DEL] -84.5Ki  [DEL] -84.4Ki    agent_data_plane::internal::control_plane::spawn_control_plane::_{{closure}}::h9b41ecabd666bd22
  [DEL]  -113Ki  [DEL]  -113Ki    agent_data_plane::cli::run::create_topology::_{{closure}}::h49037e00ff6b5d71
  -2.6%  -327Ki  -2.6%  -269Ki    [20514 Others]
  [DEL] -1.79Mi  [DEL] -1.79Mi    std::thread::local::LocalKey<T>::with::hbd3018a0c658f44a
  -0.8%  -237Ki  -0.7%  -178Ki    TOTAL

@pr-commenter
Copy link
Copy Markdown

pr-commenter Bot commented Feb 26, 2026

Regression Detector (Agent Data Plane)

Regression Detector Results

Run ID: fd442497-54ab-4f72-9d48-918fdb30688a

Baseline: 0cad7b4
Comparison: 33d24d9
Diff

❌ Experiments with retried target crashes

This is a critical error. One or more replicates failed with a non-zero exit code. These replicates may have been retried. See Replicate Execution Details for more information.

  • otlp_ingest_traces_5mb_throughput
  • otlp_ingest_traces_5mb_memory

Optimization Goals: ✅ No significant changes detected

Experiments ignored for regressions

Regressions in experiments with settings containing erratic: true are ignored.

perf experiment goal Δ mean % Δ mean % CI trials links
otlp_ingest_logs_5mb_memory memory utilization +7.62 [+7.04, +8.20] 1 (metrics) (profiles) (logs)
otlp_ingest_logs_5mb_throughput ingress throughput +0.01 [-0.12, +0.14] 1 (metrics) (profiles) (logs)
otlp_ingest_logs_5mb_cpu % cpu utilization -1.69 [-6.99, +3.61] 1 (metrics) (profiles) (logs)

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI trials links
dsd_uds_512kb_3k_contexts_cpu % cpu utilization +8.31 [-48.39, +65.02] 1 (metrics) (profiles) (logs)
otlp_ingest_logs_5mb_memory memory utilization +7.62 [+7.04, +8.20] 1 (metrics) (profiles) (logs)
dsd_uds_500mb_3k_contexts_throughput ingress throughput +2.44 [+2.31, +2.58] 1 (metrics) (profiles) (logs)
otlp_ingest_metrics_5mb_cpu % cpu utilization +1.40 [-4.69, +7.49] 1 (metrics) (profiles) (logs)
dsd_uds_500mb_3k_contexts_cpu % cpu utilization +0.55 [-0.84, +1.93] 1 (metrics) (profiles) (logs)
otlp_ingest_traces_5mb_cpu % cpu utilization +0.24 [-1.91, +2.38] 1 (metrics) (profiles) (logs)
otlp_ingest_metrics_5mb_throughput ingress throughput +0.03 [-0.10, +0.17] 1 (metrics) (profiles) (logs)
dsd_uds_10mb_3k_contexts_throughput ingress throughput +0.03 [-0.13, +0.19] 1 (metrics) (profiles) (logs)
otlp_ingest_logs_5mb_throughput ingress throughput +0.01 [-0.12, +0.14] 1 (metrics) (profiles) (logs)
quality_gates_rss_dsd_ultraheavy memory utilization +0.00 [-0.13, +0.14] 1 (metrics) (profiles) (logs)
dsd_uds_100mb_3k_contexts_throughput ingress throughput +0.00 [-0.05, +0.05] 1 (metrics) (profiles) (logs)
dsd_uds_512kb_3k_contexts_throughput ingress throughput -0.00 [-0.05, +0.05] 1 (metrics) (profiles) (logs)
otlp_ingest_traces_5mb_throughput ingress throughput -0.00 [-0.03, +0.02] 1 (metrics) (profiles) (logs)
dsd_uds_1mb_3k_contexts_throughput ingress throughput -0.00 [-0.06, +0.05] 1 (metrics) (profiles) (logs)
quality_gates_rss_dsd_heavy memory utilization -0.14 [-0.26, -0.01] 1 (metrics) (profiles) (logs)
otlp_ingest_metrics_5mb_memory memory utilization -0.46 [-0.70, -0.22] 1 (metrics) (profiles) (logs)
dsd_uds_10mb_3k_contexts_memory memory utilization -0.55 [-0.75, -0.35] 1 (metrics) (profiles) (logs)
quality_gates_rss_dsd_low memory utilization -0.59 [-0.75, -0.44] 1 (metrics) (profiles) (logs)
dsd_uds_512kb_3k_contexts_memory memory utilization -0.66 [-0.84, -0.48] 1 (metrics) (profiles) (logs)
dsd_uds_500mb_3k_contexts_memory memory utilization -0.66 [-0.84, -0.49] 1 (metrics) (profiles) (logs)
quality_gates_rss_dsd_medium memory utilization -0.67 [-0.87, -0.48] 1 (metrics) (profiles) (logs)
dsd_uds_100mb_3k_contexts_memory memory utilization -0.69 [-0.89, -0.50] 1 (metrics) (profiles) (logs)
otlp_ingest_traces_5mb_memory memory utilization -0.84 [-1.09, -0.58] 1 (metrics) (profiles) (logs)
dsd_uds_1mb_3k_contexts_memory memory utilization -1.00 [-1.18, -0.82] 1 (metrics) (profiles) (logs)
quality_gates_rss_idle memory utilization -1.42 [-1.45, -1.39] 1 (metrics) (profiles) (logs)
dsd_uds_100mb_3k_contexts_cpu % cpu utilization -1.42 [-7.03, +4.18] 1 (metrics) (profiles) (logs)
otlp_ingest_logs_5mb_cpu % cpu utilization -1.69 [-6.99, +3.61] 1 (metrics) (profiles) (logs)
dsd_uds_1mb_3k_contexts_cpu % cpu utilization -3.70 [-54.36, +46.96] 1 (metrics) (profiles) (logs)
dsd_uds_10mb_3k_contexts_cpu % cpu utilization -5.70 [-34.08, +22.69] 1 (metrics) (profiles) (logs)

Bounds Checks: ✅ Passed

perf experiment bounds_check_name replicates_passed links
quality_gates_rss_dsd_heavy memory_usage 10/10 (metrics) (profiles) (logs)
quality_gates_rss_dsd_low memory_usage 10/10 (metrics) (profiles) (logs)
quality_gates_rss_dsd_medium memory_usage 10/10 (metrics) (profiles) (logs)
quality_gates_rss_dsd_ultraheavy memory_usage 10/10 (metrics) (profiles) (logs)
quality_gates_rss_idle memory_usage 10/10 (metrics) (profiles) (logs)

Explanation

Confidence level: 90.00%
Effect size tolerance: |Δ mean %| ≥ 5.00%

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

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

Replicate Execution Details

We run multiple replicates for each experiment/variant. However, we allow replicates to be automatically retried if there are any failures, up to 8 times, at which point the replicate is marked dead and we are unable to run analysis for the entire experiment. We call each of these attempts at running replicates a replicate execution. This section lists all replicate executions that failed due to the target crashing or being oom killed.

Note: In the below tables we bucket failures by experiment, variant, and failure type. For each of these buckets we list out the replicate indexes that failed with an annotation signifying how many times said replicate failed with the given failure mode. In the below example the baseline variant of the experiment named experiment_with_failures had two replicates that failed by oom kills. Replicate 0, which failed 8 executions, and replicate 1 which failed 6 executions, all with the same failure mode.

Experiment Variant Replicates Failure Logs Debug Dashboard
experiment_with_failures baseline 0 (x8) 1 (x6) Oom killed Debug Dashboard

The debug dashboard links will take you to a debugging dashboard specifically designed to investigate replicate execution failures.

❌ Retried Normal Replicate Execution Failures (non-profiling)

Experiment Variant Replicates Failure Debug Dashboard
otlp_ingest_traces_5mb_memory comparison 7 Failed to shutdown when requested Debug Dashboard
otlp_ingest_traces_5mb_throughput baseline 2 Failed to shutdown when requested Debug Dashboard
otlp_ingest_traces_5mb_throughput comparison 2 Failed to shutdown when requested Debug Dashboard

Copy link
Copy Markdown
Member Author

tobz commented Mar 5, 2026

@tobz tobz changed the title experiment(io): reduce binary size by reducing monomorphization around HTTP client/server types enhancement(io): reduce binary size by reducing monomorphization around HTTP client/server types Mar 6, 2026
@tobz tobz added type/enhancement An enhancement in functionality or support. and removed type/experiment A change that is still currently being worked on or tested to prove viability. labels Mar 6, 2026
@tobz tobz force-pushed the tobz/unify-body-type-http-reduce-code-size branch from 33d24d9 to cbcff87 Compare March 6, 2026 20:31
@tobz tobz merged commit 90900eb into main Mar 6, 2026
55 of 58 checks passed
@tobz tobz deleted the tobz/unify-body-type-http-reduce-code-size branch March 6, 2026 20:44
dd-octo-sts Bot pushed a commit that referenced this pull request Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/components Sources, transforms, and destinations. area/io General I/O and networking. destination/prometheus Prometheus Scrape destination. type/enhancement An enhancement in functionality or support.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants