Skip to content

Commit 6309ae6

Browse files
committed
wip benchmarks
1 parent 77ee8a0 commit 6309ae6

File tree

7 files changed

+101
-19
lines changed

7 files changed

+101
-19
lines changed

taco/benchmarks/02-10k-nulls/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ terraform {
66
hostname = "otaco.app"
77
organization = "org_01K8RTMAHF3QTTX62SSE0757AM"
88
workspaces {
9-
name = "028448c3-cefd-42c2-872c-f8ce055b5554"
9+
name = "benchmark-02-10k-nulls"
1010
}
1111
}
1212
}

taco/benchmarks/03-ec2-midsize/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ terraform {
66
hostname = "otaco.app"
77
organization = "org_01K8RTMAHF3QTTX62SSE0757AM"
88
workspaces {
9-
name = "028448c3-cefd-42c2-872c-f8ce055b5554"
9+
name = "benchmark-03-ec2-midsize"
1010
}
1111
}
1212

taco/benchmarks/04-long-running-eks/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ terraform {
66
hostname = "otaco.app"
77
organization = "org_01K8RTMAHF3QTTX62SSE0757AM"
88
workspaces {
9-
name = "028448c3-cefd-42c2-872c-f8ce055b5554"
9+
name = "benchmark-04-long-running-eks"
1010
}
1111
}
1212

taco/benchmarks/05-1k-nulls-dependencies/main.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ terraform {
66
hostname = "otaco.app"
77
organization = "org_01K8RTMAHF3QTTX62SSE0757AM"
88
workspaces {
9-
name = "028448c3-cefd-42c2-872c-f8ce055b5554"
9+
name = "benchmark-05-1k-nulls-dependencies"
1010
}
1111
}
1212
}
@@ -19,15 +19,15 @@ resource "null_resource" "base" {
1919
}
2020

2121
# Create 1000 resources, each depending on the previous one (chain)
22+
# Note: Dependencies are established implicitly through the triggers reference
2223
resource "null_resource" "chain" {
2324
count = 1000
2425

2526
triggers = {
2627
index = count.index
28+
# This reference creates an implicit dependency chain
2729
previous = count.index == 0 ? null_resource.base.id : null_resource.chain[count.index - 1].id
2830
}
29-
30-
depends_on = count.index == 0 ? [null_resource.base] : [null_resource.chain[count.index - 1]]
3131
}
3232

3333
# Additional layer: create resources that depend on every 10th chain resource

taco/benchmarks/06-many-child-modules/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ terraform {
66
hostname = "otaco.app"
77
organization = "org_01K8RTMAHF3QTTX62SSE0757AM"
88
workspaces {
9-
name = "028448c3-cefd-42c2-872c-f8ce055b5554"
9+
name = "benchmark-06-many-child-modules"
1010
}
1111
}
1212
}

taco/benchmarks/07-interdependent-modules/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ terraform {
66
hostname = "otaco.app"
77
organization = "org_01K8RTMAHF3QTTX62SSE0757AM"
88
workspaces {
9-
name = "028448c3-cefd-42c2-872c-f8ce055b5554"
9+
name = "benchmark-07-interdependent-modules"
1010
}
1111
}
1212
}

taco/benchmarks/README.md

Lines changed: 93 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ This directory contains Terraform configurations for benchmarking OpenTaco cloud
5757

5858
## Running Benchmarks
5959

60-
Each benchmark is in its own directory. To run:
60+
### Manual Execution
61+
62+
Each benchmark is in its own directory. To run manually:
6163

6264
```bash
6365
cd <benchmark-directory>
@@ -66,30 +68,110 @@ terraform plan
6668
terraform apply
6769
```
6870

69-
### Timing a Benchmark
71+
### Automated Execution
72+
73+
Use the automation scripts to run all benchmarks and collect metrics:
74+
75+
```bash
76+
# Run all benchmarks (init + plan only, no apply)
77+
./run-benchmarks.sh
78+
79+
# Run specific benchmarks (by number)
80+
./run-benchmarks.sh -b "01,03,05"
81+
82+
# Run with apply (WARNING: creates real resources!)
83+
./run-benchmarks.sh --apply
84+
85+
# Run plan only, skip init
86+
./run-benchmarks.sh --no-init
87+
```
88+
89+
#### Options
90+
91+
- `-b, --benchmarks LIST` - Comma-separated list of benchmarks (e.g., "01,03,05")
92+
- `--no-init` - Skip terraform init
93+
- `--no-plan` - Skip terraform plan
94+
- `--apply` - Run terraform apply (default: off)
95+
- `--no-cleanup` - Don't clean up .terraform directories
96+
- `-o, --output DIR` - Output directory for results (default: ./results)
97+
98+
### Viewing Results
99+
100+
Results are automatically saved in JSON and CSV formats with timestamps.
70101

71102
```bash
72-
time terraform plan
73-
time terraform apply
103+
# View most recent results in table format
104+
./format-results.sh
105+
106+
# View specific results file
107+
./format-results.sh results/benchmark-results-20231124-120000.json
108+
```
109+
110+
Sample output:
111+
```
112+
Benchmark Init (s) Plan (s) Apply (s) Total (s)
113+
---------- -------- -------- --------- ---------
114+
01-simple-null 2.34 0.45 skipped 2.79
115+
02-10k-nulls 3.12 15.23 skipped 18.35
116+
03-ec2-midsize 4.56 2.11 skipped 6.67
74117
```
75118

76-
For more detailed timing:
119+
### Comparing Results
120+
121+
Compare two benchmark runs to see performance changes:
77122

78123
```bash
79-
TF_LOG=DEBUG terraform plan 2>&1 | grep -i "duration"
124+
# Compare two most recent runs
125+
./compare-results.sh
126+
127+
# Compare specific files
128+
./compare-results.sh results/benchmark-results-20231124-120000.json results/benchmark-results-20231124-130000.json
129+
```
130+
131+
Sample output:
80132
```
133+
Benchmark Baseline (s) Current (s) Diff (s) Change %
134+
01-simple-null 2.79 2.65 ↓ -0.14 -5.0%
135+
02-10k-nulls 18.35 17.89 ↓ -0.46 -2.5%
136+
03-ec2-midsize 6.67 6.82 ↑ +0.15 +2.2%
137+
```
138+
139+
### Results Structure
140+
141+
Results are saved in the `./results` directory:
142+
143+
- **JSON format**: Full detailed results with timestamps
144+
```json
145+
[
146+
{
147+
"benchmark": "01-simple-null",
148+
"timestamp": "2023-11-24T12:00:00Z",
149+
"stages": {
150+
"init": { "duration_seconds": 2.34, "status": "success" },
151+
"plan": { "duration_seconds": 0.45, "status": "success" },
152+
"apply": { "duration_seconds": 0, "status": "skipped" }
153+
}
154+
}
155+
]
156+
```
157+
158+
- **CSV format**: Easy to import into spreadsheets
159+
```csv
160+
benchmark,stage,duration_seconds,status,timestamp
161+
01-simple-null,init,2.34,success,2023-11-24T12:00:00Z
162+
01-simple-null,plan,0.45,success,2023-11-24T12:00:00Z
163+
```
81164

82165
## Next Steps
83166

84-
1. **Automation**: Create scripts to automate timing collection
85-
2. **Comparison**: Run benchmarks against competitors (Terraform Cloud, Spacelift, etc.)
86-
3. **Metrics**: Collect and analyze:
87-
- Plan time
88-
- Apply time
167+
1. **Competitor Comparison**: Run benchmarks against Terraform Cloud, Spacelift, etc.
168+
2. **Advanced Metrics**: Collect additional metrics:
89169
- Network transfer time
90170
- State file size
91171
- Log volume
92172
- Resource count vs. execution time correlation
173+
3. **CI Integration**: Add benchmark runs to CI pipeline
174+
4. **Performance Tracking**: Track performance over time, create dashboards
93175

94176
## Notes
95177

0 commit comments

Comments
 (0)