|
| 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 | +``` |
0 commit comments