Skip to content

Commit 3986a8b

Browse files
authored
chore(ci): generate SMP experiments from centralized definition to simplify adding new experiments (#1121)
1 parent def4de1 commit 3986a8b

File tree

73 files changed

+3325
-1100
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+3325
-1100
lines changed

.ci/images/build/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ ARG TARGETARCH
1010

1111
# Install the basics for building and compiling software projects.
1212
RUN apt-get update && \
13-
apt-get install -y --no-install-recommends build-essential software-properties-common curl ca-certificates git gnupg2 lsb-release make cmake unzip gcc g++ binutils jq bc bzip2 ninja-build && \
13+
apt-get install -y --no-install-recommends build-essential software-properties-common curl ca-certificates git gnupg2 \
14+
lsb-release make cmake unzip gcc g++ binutils jq bc bzip2 ninja-build python3 python3-pip && \
1415
apt-get clean
1516

1617
# Install Go, which we need to build AWS-LC in FIPS-compliant mode.

.gitlab/test.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,10 @@ check-unused-deps:
112112
stage: test
113113
script:
114114
- make check-unused-deps
115+
116+
check-smp-experiments:
117+
extends: .linux-arm64-test-job
118+
stage: test
119+
script:
120+
- pip install pyyaml
121+
- make check-smp-experiments

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
test/smp/regression/**/*.yaml

Makefile

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export CARGO_BINSTALL_STRATEGIES ?= crate-meta-data,compile
3030
ifeq ($(CI),true)
3131
override CARGO_BINSTALL_STRATEGIES = compile
3232
endif
33-
export CARGO_TOOL_VERSION_cargo-binstall ?= 1.16.2
33+
export CARGO_TOOL_VERSION_cargo-binstall ?= 1.16.7
3434
export CARGO_TOOL_VERSION_dd-rust-license-tool ?= 1.0.3
3535
export CARGO_TOOL_VERSION_cargo-deny ?= 0.18.9
3636
export CARGO_TOOL_VERSION_cargo-hack ?= 0.6.30
@@ -594,6 +594,16 @@ endif
594594
--inlined-functions true --timeline --upload-period 10 --preset cpu_live_heap \
595595
target/release/agent-data-plane run
596596

597+
.PHONY: generate-smp-experiments
598+
generate-smp-experiments: ## Generates SMP experiment configs from experiments.yaml
599+
@echo "[*] Generating SMP experiment configurations..."
600+
@python3 test/smp/regression/adp/generate_experiments.py
601+
602+
.PHONY: check-smp-experiments
603+
check-smp-experiments: ## Verifies SMP experiment configs are up-to-date (CI)
604+
@echo "[*] Checking SMP experiment configurations..."
605+
@python3 test/smp/regression/adp/generate_experiments.py --check
606+
597607
.PHONY: profile-run-smp-experiment
598608
profile-run-smp-experiment: ## Runs a specific SMP experiment for Saluki
599609
ifeq ($(shell test -f test/smp/regression/adp/cases/$(EXPERIMENT)/lading/lading.yaml || echo not-found), not-found)
@@ -703,4 +713,4 @@ cargo-preinstall: ## Pre-installs all necessary Cargo tools (used for CI)
703713
cargo-install-%: override TOOL = $(@:cargo-install-%=%)
704714
cargo-install-%: override VERSIONED_TOOL = ${TOOL}@$(CARGO_TOOL_VERSION_$(TOOL))
705715
cargo-install-%: check-rust-build-tools
706-
@$(if $(findstring true,$(AUTOINSTALL)),test -f ${CARGO_BIN_DIR}/${TOOL} || (echo "[*] Installing ${VERSIONED_TOOL}..." && cargo binstall --strategies ${CARGO_BINSTALL_STRATEGIES} --install-path ${CARGO_BIN_DIR} ${VERSIONED_TOOL} --quiet -y),)
716+
@$(if $(findstring true,$(AUTOINSTALL)),test -f ${CARGO_BIN_DIR}/${TOOL} || (echo "[*] Installing ${VERSIONED_TOOL}..." && cargo binstall --strategies ${CARGO_BINSTALL_STRATEGIES} ${VERSIONED_TOOL} --quiet -y),)

bin/correctness/stele/src/traces/stats.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ impl BucketedClientStatistics {
235235
None => return Ok(None),
236236
};
237237

238-
while let Some(other) = bucket_stats.next() {
238+
for other in bucket_stats {
239239
merged_stats.merge(other)?;
240240
}
241241

test/smp/README.md

Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
# SMP (Single Machine Performance) Experiments
2+
3+
This directory contains performance regression tests for ADP (Agent Data Plane) that run on the Single Machine Performance infrastructure.
4+
5+
## Overview
6+
7+
SMP tests measure ADP's performance characteristics under various workloads. Each experiment defines:
8+
9+
- **Target configuration**: How ADP is configured (environment variables, resource limits)
10+
- **Load generation**: What traffic is sent to ADP (via [lading](https://github.com/DataDog/lading))
11+
- **Optimization goal**: What metric to optimize for (`cpu`, `memory`, or `ingress_throughput`)
12+
- **Quality checks**: Optional bounds on metrics (e.g., memory usage limits)
13+
14+
## Directory Structure
15+
16+
```
17+
test/smp/regression/adp/
18+
├── experiments.yaml # Experiment definitions (source of truth)
19+
├── generate_experiments.py # Script to generate case directories
20+
└── cases/ # Generated experiment configurations
21+
└── <experiment_name>/
22+
├── experiment.yaml
23+
├── lading/
24+
│ └── lading.yaml
25+
└── agent-data-plane/
26+
└── ...
27+
```
28+
29+
## Defining Experiments
30+
31+
All experiments are defined in `experiments.yaml`. The file has three sections:
32+
33+
### Global Configuration
34+
35+
Settings inherited by all experiments:
36+
37+
```yaml
38+
global:
39+
erratic: false
40+
target:
41+
name: agent-data-plane
42+
cpu_allotment: 4
43+
memory_allotment: 2GiB
44+
# ... shared environment variables, profiling settings
45+
report_links:
46+
# ... dashboard links
47+
lading:
48+
blackhole:
49+
# ... default sink configuration
50+
target_metrics:
51+
# ... metrics scraping configuration
52+
```
53+
54+
### Templates
55+
56+
Reusable partial configurations that experiments can extend:
57+
58+
```yaml
59+
templates:
60+
dsd_base:
61+
target:
62+
environment:
63+
DD_DATA_PLANE_DOGSTATSD_ENABLED: "true"
64+
# ... DogStatsD-specific settings
65+
lading:
66+
generator:
67+
- unix_datagram:
68+
# ... base generator config
69+
70+
otlp_base:
71+
target:
72+
environment:
73+
DD_DATA_PLANE_OTLP_ENABLED: "true"
74+
# ... OTLP-specific settings
75+
```
76+
77+
### Experiments
78+
79+
Individual experiment definitions:
80+
81+
```yaml
82+
experiments:
83+
- name: my_experiment
84+
extends: dsd_base # Inherit from template
85+
optimization_goal: memory # Single goal
86+
# or
87+
optimization_goals: [cpu, memory, ingress_throughput] # Multiple goals
88+
89+
target:
90+
environment:
91+
# Experiment-specific overrides
92+
93+
checks: # Optional quality gates
94+
- name: memory_usage
95+
bounds:
96+
series: total_rss_bytes
97+
upper_bound: "100.0 MiB"
98+
99+
lading:
100+
generator:
101+
- unix_datagram:
102+
bytes_per_second: "10 MiB" # Merged with template's generator
103+
```
104+
105+
## Configuration Inheritance
106+
107+
Configuration is merged in order: `global` → `template` → `experiment`
108+
109+
- **Dictionaries** are deep-merged (experiment values override inherited values)
110+
- **Lists** are replaced entirely, except for `lading.generator` which merges by generator type
111+
- **`null` values** remove inherited keys
112+
113+
### Generator Merging
114+
115+
The `lading.generator` list uses type-aware merging. If both the template and experiment define a generator of the same type (e.g., `unix_datagram`), their configurations are merged:
116+
117+
```yaml
118+
# Template defines full generator config
119+
templates:
120+
dsd_base:
121+
lading:
122+
generator:
123+
- unix_datagram:
124+
seed: [2, 3, 5, ...]
125+
path: /tmp/adp-dogstatsd-dgram.sock
126+
variant:
127+
dogstatsd:
128+
# ... full variant config
129+
maximum_prebuild_cache_size_bytes: "500 Mb"
130+
131+
# Experiment only overrides what differs
132+
experiments:
133+
- name: my_experiment
134+
extends: dsd_base
135+
lading:
136+
generator:
137+
- unix_datagram:
138+
bytes_per_second: "10 MiB" # Merged into template config
139+
```
140+
141+
## Optimization Goals
142+
143+
Use `optimization_goal` (singular) for a single goal, or `optimization_goals` (plural) to generate multiple experiment variants:
144+
145+
```yaml
146+
# Single goal - generates: my_experiment/
147+
- name: my_experiment
148+
optimization_goal: memory
149+
150+
# Multiple goals - generates: my_experiment_cpu/, my_experiment_memory/, my_experiment_throughput/
151+
- name: my_experiment
152+
optimization_goals: [cpu, memory, ingress_throughput]
153+
```
154+
155+
## Custom Target Files
156+
157+
Experiments can specify custom files to place in the target directory (named after `target.name`, e.g., `agent-data-plane/`). Files can be specified with inline content or copied from shared files.
158+
159+
### Inline Content
160+
161+
Write content directly to a file:
162+
163+
```yaml
164+
target:
165+
files:
166+
empty.yaml:
167+
content: "{}"
168+
169+
# YAML content is automatically serialized
170+
config.yaml:
171+
content:
172+
some_key: some_value
173+
nested:
174+
key: value
175+
```
176+
177+
### Copying Shared Files
178+
179+
Copy files from a source path relative to `experiments.yaml`:
180+
181+
```yaml
182+
target:
183+
files:
184+
cert.pem:
185+
source: shared/cert.pem # Relative to experiments.yaml
186+
```
187+
188+
### Default Behavior
189+
190+
If no `files` are specified, a default `empty.yaml` with `{}` content is created. Files are inherited from global/templates and merged with experiment-specific files (experiment values take precedence on conflict).
191+
192+
## Regenerating Experiments
193+
194+
After modifying `experiments.yaml`, regenerate the case directories:
195+
196+
```bash
197+
make generate-smp-experiments
198+
```
199+
200+
To verify configurations are up-to-date (useful in CI):
201+
202+
```bash
203+
make check-smp-experiments
204+
```
205+
206+
## Running Experiments Locally
207+
208+
To run a specific experiment locally for profiling:
209+
210+
```bash
211+
# First, start ADP with profiling enabled
212+
make profile-run-adp
213+
214+
# Then, in another terminal, run the experiment's load generator
215+
make profile-run-smp-experiment EXPERIMENT=dsd_uds_10mb_3k_contexts_throughput
216+
```
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
-----BEGIN CERTIFICATE-----
2+
MIIDwTCCAqmgAwIBAgIUGNrRiJ81arCE1jTvLRoxxuLVoHAwDQYJKoZIhvcNAQEL
3+
BQAwgYgxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJOWTEWMBQGA1UEBwwNTmV3IFlv
4+
cmsgQ2l0eTEWMBQGA1UECgwNRGF0YWRvZywgSW5jLjEoMCYGA1UECwwfU2VsZi1T
5+
aWduZWQgVGVzdGluZyBD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sG7h36dK1l
39+
Yxv6xx/a857kbZYnB53DCQ3dmwKBgQC1NY09e3Qq+hXyuZEJSsHE5LAYd9TeWs+D
40+
FuUmL8FQkGCihQz/fX3+yJar4oXDoIHnhEwGEEKkOoT9EJ4uzW9L0WSy6fopjRs2
41+
lXTnQBbB7414ZYkTM/oanTh7dBVG307oyb6d5+Jl0NPxs5Fomh6xOMWD8hB0+CTw
42+
bAaO/c5YYwKBgATdlM5ze5mjYzC+924SekB0322lbQYiiU+uTswLgU+ASbnxdY/Z
43+
Lzm70tvFBV84bQmdI6OwFIDJBRXhAQ567bJkiPm4IaAxJZNY5TKDFX8lyKwpgKK2
44+
6FDSGqSGl3zBfQreC2tCBapJTwunxlZFsph3zbVcqvNG4fQ3Yh8FAl33AoGADR9l
45+
rRAlp38Y280Ibc3WHnYZMoxrA/c7k9iym4NV0onCFcLg4BesaikIkEYFPdd/0M5J
46+
2x6OVOpP+yua6PTDnI/7ZOGA1kV7tQY5ww1nGIBKlG9178gR0p+UGYychddiFYWW
47+
okTKpmjrEFPaseKHWnosA5QiEPZvZmHMT8qdiNUCgYAweUc7+5slfxKYVLUo34p9
48+
BiED632dV2YA7CYf+iEjXoFjCOH+ZqzI7OGfODpSMpjim3Fxt++UWbJscbNmtCZr
49+
UeNDsJxiC+eksGWqpu0QoKdNPYRBB2QQFcvTT0AVt6PTzKaFVBvF/dnLuODjXp9Y
50+
R5Ivn5V7QPeMY56Uzr2fJQ==
51+
-----END PRIVATE KEY-----
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
optimization_goal: cpu
2+
erratic: false
3+
target:
4+
name: agent-data-plane
5+
command: /maybe-profile.sh /usr/local/bin/agent-data-plane --config /etc/agent-data-plane/empty.yaml run
6+
cpu_allotment: 4
7+
memory_allotment: 2GiB
8+
environment:
9+
DD_HOSTNAME: smp-regression
10+
DD_API_KEY: foo00000001
11+
DD_DD_URL: http://127.0.0.1:9091
12+
DD_IPC_CERT_FILE_PATH: /etc/agent-data-plane/cert.pem
13+
DD_LOG_FORMAT_JSON: "true"
14+
DD_DATA_PLANE_STANDALONE_MODE: "true"
15+
DD_DATA_PLANE_TELEMETRY_ENABLED: "true"
16+
DD_DATA_PLANE_TELEMETRY_LISTEN_ADDR: tcp://127.0.0.1:5102
17+
DD_DATA_PLANE_DOGSTATSD_ENABLED: "true"
18+
DD_DOGSTATSD_PORT: "0"
19+
DD_DOGSTATSD_SOCKET: /tmp/adp-dogstatsd-dgram.sock
20+
DD_AGGREGATE_CONTEXT_LIMIT: "3100"
21+
profiling_environment:
22+
SMP_PROFILING_ENABLED: "true"
23+
DD_SERVICE: agent-data-plane
24+
DD_TRACE_AGENT_URL: unix:///smp-host/apm.socket
25+
DD_PROFILING_NATIVE_PRESET: cpu_live_heap
26+
DD_PROFILING_INLINED_FUNCTIONS: "true"
27+
report_links:
28+
- text: (metrics)
29+
link: https://app.datadoghq.com/dashboard/4br-nxz-khi?fromUser=true&refresh_mode=paused&tpl_var_adp-run-id%5B0%5D={{ job_id
30+
}}&tpl_var_experiment%5B0%5D={{ experiment }}&view=spans&from_ts={{ start_time_ms }}&to_ts={{ end_time_ms }}&live=false
31+
- text: (profiles)
32+
link: https://app.datadoghq.com/profiling/explorer?query=env%3Asingle-machine-performance%20service%3Aagent-data-plane%20job_id%3A{{
33+
job_id }}%20experiment%3A{{ experiment }}&agg_m=count&agg_m_source=base&agg_t=count&fromUser=false&viz=stream&start={{
34+
filter_start }}&end={{ filter_end }}&paused=true
35+
- text: (logs)
36+
link: https://app.datadoghq.com/logs?query=experiment%3A{{ experiment }}%20run_id%3A{{ job_id }}&agg_m=count&agg_m_source=base&agg_q=%40span.url&agg_q_source=base&agg_t=count&fromUser=true&index=single-machine-performance-target-logs&messageDisplay=inline&refresh_mode=paused&storage=hot&stream_sort=time%2Cdesc&top_n=100&top_o=top&viz=stream&x_missing=true&from_ts={{
37+
filter_start }}&to_ts={{ filter_end }}&live=false

0 commit comments

Comments
 (0)