Skip to content

Commit f05877a

Browse files
authored
Tune benchmark params to reduce variance (#8308)
1 parent bc542ae commit f05877a

3 files changed

Lines changed: 19 additions & 19 deletions

File tree

sdk/all/src/jmh/java/io/opentelemetry/sdk/LogRecordBenchmark.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ public void tearDown() {
112112
@Benchmark
113113
@Group("threads1")
114114
@GroupThreads(1)
115-
@Fork(1)
116-
@Warmup(iterations = 5, time = 1)
117-
@Measurement(iterations = 5, time = 1)
115+
@Fork(3)
116+
@Warmup(iterations = 3, time = 1)
117+
@Measurement(iterations = 10, time = 1)
118118
@OperationsPerInvocation(RECORDS_PER_INVOCATION)
119119
public void record_SingleThread(BenchmarkState benchmarkState) {
120120
record(benchmarkState);
@@ -123,9 +123,9 @@ public void record_SingleThread(BenchmarkState benchmarkState) {
123123
@Benchmark
124124
@Group("threads" + MAX_THREADS)
125125
@GroupThreads(MAX_THREADS)
126-
@Fork(1)
127-
@Warmup(iterations = 5, time = 1)
128-
@Measurement(iterations = 5, time = 1)
126+
@Fork(3)
127+
@Warmup(iterations = 3, time = 1)
128+
@Measurement(iterations = 10, time = 1)
129129
@OperationsPerInvocation(RECORDS_PER_INVOCATION)
130130
public void record_MultipleThreads(BenchmarkState benchmarkState) {
131131
record(benchmarkState);

sdk/all/src/jmh/java/io/opentelemetry/sdk/MetricRecordBenchmark.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public static class BenchmarkState {
9696

9797
@Param AggregationTemporality aggregationTemporality;
9898

99-
@Param({"1", "100"})
99+
@Param({"1", "128"})
100100
int cardinality;
101101

102102
// The following parameters are excluded from the benchmark to reduce combinatorial explosion
@@ -187,9 +187,9 @@ public void tearDown() {
187187
@Benchmark
188188
@Group("threads1")
189189
@GroupThreads(1)
190-
@Fork(1)
191-
@Warmup(iterations = 5, time = 1)
192-
@Measurement(iterations = 5, time = 1)
190+
@Fork(3)
191+
@Warmup(iterations = 3, time = 1)
192+
@Measurement(iterations = 10, time = 1)
193193
@OperationsPerInvocation(RECORDS_PER_INVOCATION)
194194
public void record_SingleThread(BenchmarkState benchmarkState) {
195195
record(benchmarkState);
@@ -198,9 +198,9 @@ public void record_SingleThread(BenchmarkState benchmarkState) {
198198
@Benchmark
199199
@Group("threads" + MAX_THREADS)
200200
@GroupThreads(MAX_THREADS)
201-
@Fork(1)
202-
@Warmup(iterations = 5, time = 1)
203-
@Measurement(iterations = 5, time = 1)
201+
@Fork(3)
202+
@Warmup(iterations = 3, time = 1)
203+
@Measurement(iterations = 10, time = 1)
204204
@OperationsPerInvocation(RECORDS_PER_INVOCATION)
205205
public void record_MultipleThreads(BenchmarkState benchmarkState) {
206206
record(benchmarkState);

sdk/all/src/jmh/java/io/opentelemetry/sdk/SpanRecordBenchmark.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,9 @@ public void tearDown() {
123123
@Benchmark
124124
@Group("threads1")
125125
@GroupThreads(1)
126-
@Fork(1)
127-
@Warmup(iterations = 5, time = 1)
128-
@Measurement(iterations = 5, time = 1)
126+
@Fork(3)
127+
@Warmup(iterations = 3, time = 1)
128+
@Measurement(iterations = 10, time = 1)
129129
@OperationsPerInvocation(RECORDS_PER_INVOCATION)
130130
public void record_SingleThread(BenchmarkState benchmarkState) {
131131
record(benchmarkState);
@@ -134,9 +134,9 @@ public void record_SingleThread(BenchmarkState benchmarkState) {
134134
@Benchmark
135135
@Group("threads" + MAX_THREADS)
136136
@GroupThreads(MAX_THREADS)
137-
@Fork(1)
138-
@Warmup(iterations = 5, time = 1)
139-
@Measurement(iterations = 5, time = 1)
137+
@Fork(3)
138+
@Warmup(iterations = 3, time = 1)
139+
@Measurement(iterations = 10, time = 1)
140140
@OperationsPerInvocation(RECORDS_PER_INVOCATION)
141141
public void record_MultipleThreads(BenchmarkState benchmarkState) {
142142
record(benchmarkState);

0 commit comments

Comments
 (0)