Skip to content

Commit dc3fe95

Browse files
ci(NODE-6501): use latest node in spec benchmarks (#4314)
1 parent 2f3fb46 commit dc3fe95

File tree

4 files changed

+26
-14
lines changed

4 files changed

+26
-14
lines changed

.evergreen/config.in.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,7 +1147,7 @@ tasks:
11471147
- func: bootstrap kms servers
11481148
- func: "run serverless tests"
11491149

1150-
- name: run-spec-benchmark-tests-node-18-server-6.0
1150+
- name: run-spec-benchmark-tests-node-server
11511151
tags:
11521152
- run-spec-benchmark-tests
11531153
- performance
@@ -1157,8 +1157,7 @@ tasks:
11571157
type: setup
11581158
params:
11591159
updates:
1160-
- { key: NODE_LTS_VERSION, value: v18.16.0 }
1161-
- { key: NPM_VERSION, value: "9" }
1160+
- { key: NODE_LTS_VERSION, value: v22.11.0 }
11621161
- { key: VERSION, value: v6.0-perf }
11631162
- { key: TOPOLOGY, value: server }
11641163
- { key: AUTH, value: noauth }
@@ -1616,4 +1615,4 @@ buildvariants:
16161615
display_name: Performance Test
16171616
run_on: rhel90-dbx-perf-large
16181617
tasks:
1619-
- run-spec-benchmark-tests-node-18-server-6.0
1618+
- run-spec-benchmark-tests-node-server

.evergreen/config.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,7 +1108,7 @@ tasks:
11081108
- func: install dependencies
11091109
- func: bootstrap kms servers
11101110
- func: run serverless tests
1111-
- name: run-spec-benchmark-tests-node-18-server-6.0
1111+
- name: run-spec-benchmark-tests-node-server
11121112
tags:
11131113
- run-spec-benchmark-tests
11141114
- performance
@@ -1118,8 +1118,7 @@ tasks:
11181118
type: setup
11191119
params:
11201120
updates:
1121-
- {key: NODE_LTS_VERSION, value: v18.16.0}
1122-
- {key: NPM_VERSION, value: '9'}
1121+
- {key: NODE_LTS_VERSION, value: v22.11.0}
11231122
- {key: VERSION, value: v6.0-perf}
11241123
- {key: TOPOLOGY, value: server}
11251124
- {key: AUTH, value: noauth}
@@ -4547,7 +4546,7 @@ buildvariants:
45474546
display_name: Performance Test
45484547
run_on: rhel90-dbx-perf-large
45494548
tasks:
4550-
- run-spec-benchmark-tests-node-18-server-6.0
4549+
- run-spec-benchmark-tests-node-server
45514550
- name: rhel80-large-gallium
45524551
display_name: rhel8 Node16
45534552
run_on: rhel80-large

test/benchmarks/mongoBench/constants.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,12 @@ const DEFAULT_MAX_EXECUTION_TIME =
1212
const DEFAULT_MIN_EXECUTION_COUNT =
1313
Number.parseInt(process.env.DRIVER_BENCH_MIN_EX_COUNT, 10) || 100;
1414

15+
const DEFAULT_MAX_EXECUTION_COUNT =
16+
Number.parseInt(process.env.DRIVER_BENCH_MAX_EX_COUNT, 10) || 10000000;
17+
1518
module.exports = {
1619
DEFAULT_MIN_EXECUTION_COUNT,
1720
DEFAULT_MIN_EXECUTION_TIME,
18-
DEFAULT_MAX_EXECUTION_TIME
21+
DEFAULT_MAX_EXECUTION_TIME,
22+
DEFAULT_MAX_EXECUTION_COUNT
1923
};

test/benchmarks/mongoBench/runner.js

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function calculateMicroBench(benchmark, data) {
3939
const rawData = data.rawData;
4040
const count = data.count;
4141

42-
const sortedData = [].concat(rawData).sort();
42+
const sortedData = [].concat(rawData).sort((a, b) => a - b);
4343

4444
const percentiles = PERCENTILES.reduce((acc, pct) => {
4545
acc[pct] = sortedData[percentileIndex(pct, count)];
@@ -57,6 +57,7 @@ class Runner {
5757
this.minExecutionTime = options.minExecutionTime || CONSTANTS.DEFAULT_MIN_EXECUTION_TIME;
5858
this.maxExecutionTime = options.maxExecutionTime || CONSTANTS.DEFAULT_MAX_EXECUTION_TIME;
5959
this.minExecutionCount = options.minExecutionCount || CONSTANTS.DEFAULT_MIN_EXECUTION_COUNT;
60+
this.maxExecutionCount = options.maxExecutionCount || CONSTANTS.DEFAULT_MAX_EXECUTION_COUNT;
6061
this.reporter =
6162
options.reporter ||
6263
function () {
@@ -126,6 +127,7 @@ class Runner {
126127
for (const [name, benchmark] of benchmarks) {
127128
this.reporter(` Executing Benchmark "${name}"`);
128129
result[name] = await this._runBenchmark(benchmark);
130+
this.reporter(` Executed Benchmark "${name}" =`, result[name]);
129131
}
130132

131133
return result;
@@ -162,12 +164,17 @@ class Runner {
162164
const minExecutionCount = this.minExecutionCount;
163165
const minExecutionTime = this.minExecutionTime;
164166
const maxExecutionTime = this.maxExecutionTime;
167+
const maxExecutionAttempts = this.maxExecutionCount;
165168
let time = performance.now() - start;
166169
let count = 1;
167170

168171
const taskTimer = benchmark._taskType === 'sync' ? timeSyncTask : timeAsyncTask;
169172

170-
while (time < maxExecutionTime && (time < minExecutionTime || count < minExecutionCount)) {
173+
while (
174+
time < maxExecutionTime &&
175+
(time < minExecutionTime || count < minExecutionCount) &&
176+
count <= maxExecutionAttempts
177+
) {
171178
await benchmark.beforeTask.call(ctx);
172179
const executionTime = await taskTimer(benchmark.task, ctx);
173180
rawData.push(executionTime);
@@ -181,9 +188,12 @@ class Runner {
181188
};
182189
}
183190

184-
_errorHandler(e) {
185-
console.error(e);
186-
return NaN;
191+
_errorHandler(error) {
192+
this.reporter(`Error: ${error.name} - ${error.message} - ${error.stack}`);
193+
for (let error = error.cause; error != null; error = error.cause) {
194+
this.reporter(`Caused by: ${error.name} - ${error.message} - ${error.stack}`);
195+
}
196+
throw error;
187197
}
188198
}
189199

0 commit comments

Comments
 (0)