@@ -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
6365cd < benchmark-directory>
@@ -66,30 +68,110 @@ terraform plan
6668terraform 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