Skip to content

Commit

Permalink
ci(NODE-6501): use latest node in spec benchmarks (#4314)
Browse files Browse the repository at this point in the history
  • Loading branch information
baileympearson authored Nov 5, 2024
1 parent 2f3fb46 commit dc3fe95
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 14 deletions.
7 changes: 3 additions & 4 deletions .evergreen/config.in.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1147,7 +1147,7 @@ tasks:
- func: bootstrap kms servers
- func: "run serverless tests"

- name: run-spec-benchmark-tests-node-18-server-6.0
- name: run-spec-benchmark-tests-node-server
tags:
- run-spec-benchmark-tests
- performance
Expand All @@ -1157,8 +1157,7 @@ tasks:
type: setup
params:
updates:
- { key: NODE_LTS_VERSION, value: v18.16.0 }
- { key: NPM_VERSION, value: "9" }
- { key: NODE_LTS_VERSION, value: v22.11.0 }
- { key: VERSION, value: v6.0-perf }
- { key: TOPOLOGY, value: server }
- { key: AUTH, value: noauth }
Expand Down Expand Up @@ -1616,4 +1615,4 @@ buildvariants:
display_name: Performance Test
run_on: rhel90-dbx-perf-large
tasks:
- run-spec-benchmark-tests-node-18-server-6.0
- run-spec-benchmark-tests-node-server
7 changes: 3 additions & 4 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1108,7 +1108,7 @@ tasks:
- func: install dependencies
- func: bootstrap kms servers
- func: run serverless tests
- name: run-spec-benchmark-tests-node-18-server-6.0
- name: run-spec-benchmark-tests-node-server
tags:
- run-spec-benchmark-tests
- performance
Expand All @@ -1118,8 +1118,7 @@ tasks:
type: setup
params:
updates:
- {key: NODE_LTS_VERSION, value: v18.16.0}
- {key: NPM_VERSION, value: '9'}
- {key: NODE_LTS_VERSION, value: v22.11.0}
- {key: VERSION, value: v6.0-perf}
- {key: TOPOLOGY, value: server}
- {key: AUTH, value: noauth}
Expand Down Expand Up @@ -4547,7 +4546,7 @@ buildvariants:
display_name: Performance Test
run_on: rhel90-dbx-perf-large
tasks:
- run-spec-benchmark-tests-node-18-server-6.0
- run-spec-benchmark-tests-node-server
- name: rhel80-large-gallium
display_name: rhel8 Node16
run_on: rhel80-large
Expand Down
6 changes: 5 additions & 1 deletion test/benchmarks/mongoBench/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ const DEFAULT_MAX_EXECUTION_TIME =
const DEFAULT_MIN_EXECUTION_COUNT =
Number.parseInt(process.env.DRIVER_BENCH_MIN_EX_COUNT, 10) || 100;

const DEFAULT_MAX_EXECUTION_COUNT =
Number.parseInt(process.env.DRIVER_BENCH_MAX_EX_COUNT, 10) || 10000000;

module.exports = {
DEFAULT_MIN_EXECUTION_COUNT,
DEFAULT_MIN_EXECUTION_TIME,
DEFAULT_MAX_EXECUTION_TIME
DEFAULT_MAX_EXECUTION_TIME,
DEFAULT_MAX_EXECUTION_COUNT
};
20 changes: 15 additions & 5 deletions test/benchmarks/mongoBench/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function calculateMicroBench(benchmark, data) {
const rawData = data.rawData;
const count = data.count;

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

const percentiles = PERCENTILES.reduce((acc, pct) => {
acc[pct] = sortedData[percentileIndex(pct, count)];
Expand All @@ -57,6 +57,7 @@ class Runner {
this.minExecutionTime = options.minExecutionTime || CONSTANTS.DEFAULT_MIN_EXECUTION_TIME;
this.maxExecutionTime = options.maxExecutionTime || CONSTANTS.DEFAULT_MAX_EXECUTION_TIME;
this.minExecutionCount = options.minExecutionCount || CONSTANTS.DEFAULT_MIN_EXECUTION_COUNT;
this.maxExecutionCount = options.maxExecutionCount || CONSTANTS.DEFAULT_MAX_EXECUTION_COUNT;
this.reporter =
options.reporter ||
function () {
Expand Down Expand Up @@ -126,6 +127,7 @@ class Runner {
for (const [name, benchmark] of benchmarks) {
this.reporter(` Executing Benchmark "${name}"`);
result[name] = await this._runBenchmark(benchmark);
this.reporter(` Executed Benchmark "${name}" =`, result[name]);
}

return result;
Expand Down Expand Up @@ -162,12 +164,17 @@ class Runner {
const minExecutionCount = this.minExecutionCount;
const minExecutionTime = this.minExecutionTime;
const maxExecutionTime = this.maxExecutionTime;
const maxExecutionAttempts = this.maxExecutionCount;
let time = performance.now() - start;
let count = 1;

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

while (time < maxExecutionTime && (time < minExecutionTime || count < minExecutionCount)) {
while (
time < maxExecutionTime &&
(time < minExecutionTime || count < minExecutionCount) &&
count <= maxExecutionAttempts
) {
await benchmark.beforeTask.call(ctx);
const executionTime = await taskTimer(benchmark.task, ctx);
rawData.push(executionTime);
Expand All @@ -181,9 +188,12 @@ class Runner {
};
}

_errorHandler(e) {
console.error(e);
return NaN;
_errorHandler(error) {
this.reporter(`Error: ${error.name} - ${error.message} - ${error.stack}`);
for (let error = error.cause; error != null; error = error.cause) {
this.reporter(`Caused by: ${error.name} - ${error.message} - ${error.stack}`);
}
throw error;
}
}

Expand Down

0 comments on commit dc3fe95

Please sign in to comment.