Skip to content

Commit ed25d56

Browse files
authored
chore(NODE-6459): compare CSOT performance (mongodb#4304)
1 parent 19ecf07 commit ed25d56

File tree

6 files changed

+123
-7
lines changed

6 files changed

+123
-7
lines changed

.evergreen/config.in.yml

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1103,6 +1103,7 @@ functions:
11031103
PROJECT_DIRECTORY: ${PROJECT_DIRECTORY}
11041104
MONGODB_URI: ${MONGODB_URI}
11051105
DRIVERS_TOOLS: ${DRIVERS_TOOLS}
1106+
MONGODB_CLIENT_OPTIONS: ${MONGODB_CLIENT_OPTIONS}
11061107
binary: bash
11071108
args:
11081109
- ${PROJECT_DIRECTORY}/.evergreen/run-benchmarks.sh
@@ -1168,6 +1169,50 @@ tasks:
11681169
params:
11691170
file: src/results.json
11701171

1172+
- name: run-spec-benchmark-tests-node-server-timeoutMS-120000
1173+
tags:
1174+
- run-spec-benchmark-tests
1175+
- performance
1176+
exec_timeout_secs: 3600
1177+
commands:
1178+
- command: expansions.update
1179+
type: setup
1180+
params:
1181+
updates:
1182+
- { key: NODE_LTS_VERSION, value: v22.11.0 }
1183+
- { key: VERSION, value: v6.0-perf }
1184+
- { key: TOPOLOGY, value: server }
1185+
- { key: AUTH, value: noauth }
1186+
- { key: MONGODB_CLIENT_OPTIONS, value: '{"timeoutMS": 120000}' }
1187+
- func: install dependencies
1188+
- func: bootstrap mongo-orchestration
1189+
- func: run spec driver benchmarks
1190+
- command: perf.send
1191+
params:
1192+
file: src/results.json
1193+
1194+
- name: run-spec-benchmark-tests-node-server-timeoutMS-0
1195+
tags:
1196+
- run-spec-benchmark-tests
1197+
- performance
1198+
exec_timeout_secs: 3600
1199+
commands:
1200+
- command: expansions.update
1201+
type: setup
1202+
params:
1203+
updates:
1204+
- { key: NODE_LTS_VERSION, value: v22.11.0 }
1205+
- { key: VERSION, value: v6.0-perf }
1206+
- { key: TOPOLOGY, value: server }
1207+
- { key: AUTH, value: noauth }
1208+
- { key: MONGODB_CLIENT_OPTIONS, value: '{"timeoutMS": 0}' }
1209+
- func: install dependencies
1210+
- func: bootstrap mongo-orchestration
1211+
- func: run spec driver benchmarks
1212+
- command: perf.send
1213+
params:
1214+
file: src/results.json
1215+
11711216
- name: "test-gcpkms-task"
11721217
commands:
11731218
- command: expansions.update
@@ -1300,7 +1345,7 @@ tasks:
13001345
include_expansions_in_env: ["AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY", "AWS_SESSION_TOKEN"]
13011346
args:
13021347
- .evergreen/run-oidc-tests-k8s.sh
1303-
1348+
13041349
- name: "oidc-auth-test-k8s-latest-aks"
13051350
commands:
13061351
- func: "install dependencies"
@@ -1736,3 +1781,5 @@ buildvariants:
17361781
run_on: rhel90-dbx-perf-large
17371782
tasks:
17381783
- run-spec-benchmark-tests-node-server
1784+
- run-spec-benchmark-tests-node-server-timeoutMS-120000
1785+
- run-spec-benchmark-tests-node-server-timeoutMS-0

.evergreen/config.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,6 +1065,7 @@ functions:
10651065
PROJECT_DIRECTORY: ${PROJECT_DIRECTORY}
10661066
MONGODB_URI: ${MONGODB_URI}
10671067
DRIVERS_TOOLS: ${DRIVERS_TOOLS}
1068+
MONGODB_CLIENT_OPTIONS: ${MONGODB_CLIENT_OPTIONS}
10681069
binary: bash
10691070
args:
10701071
- ${PROJECT_DIRECTORY}/.evergreen/run-benchmarks.sh
@@ -1128,6 +1129,48 @@ tasks:
11281129
- command: perf.send
11291130
params:
11301131
file: src/results.json
1132+
- name: run-spec-benchmark-tests-node-server-timeoutMS-120000
1133+
tags:
1134+
- run-spec-benchmark-tests
1135+
- performance
1136+
exec_timeout_secs: 3600
1137+
commands:
1138+
- command: expansions.update
1139+
type: setup
1140+
params:
1141+
updates:
1142+
- {key: NODE_LTS_VERSION, value: v22.11.0}
1143+
- {key: VERSION, value: v6.0-perf}
1144+
- {key: TOPOLOGY, value: server}
1145+
- {key: AUTH, value: noauth}
1146+
- {key: MONGODB_CLIENT_OPTIONS, value: '{"timeoutMS": 120000}'}
1147+
- func: install dependencies
1148+
- func: bootstrap mongo-orchestration
1149+
- func: run spec driver benchmarks
1150+
- command: perf.send
1151+
params:
1152+
file: src/results.json
1153+
- name: run-spec-benchmark-tests-node-server-timeoutMS-0
1154+
tags:
1155+
- run-spec-benchmark-tests
1156+
- performance
1157+
exec_timeout_secs: 3600
1158+
commands:
1159+
- command: expansions.update
1160+
type: setup
1161+
params:
1162+
updates:
1163+
- {key: NODE_LTS_VERSION, value: v22.11.0}
1164+
- {key: VERSION, value: v6.0-perf}
1165+
- {key: TOPOLOGY, value: server}
1166+
- {key: AUTH, value: noauth}
1167+
- {key: MONGODB_CLIENT_OPTIONS, value: '{"timeoutMS": 0}'}
1168+
- func: install dependencies
1169+
- func: bootstrap mongo-orchestration
1170+
- func: run spec driver benchmarks
1171+
- command: perf.send
1172+
params:
1173+
file: src/results.json
11311174
- name: test-gcpkms-task
11321175
commands:
11331176
- command: expansions.update
@@ -4670,6 +4713,8 @@ buildvariants:
46704713
run_on: rhel90-dbx-perf-large
46714714
tasks:
46724715
- run-spec-benchmark-tests-node-server
4716+
- run-spec-benchmark-tests-node-server-timeoutMS-120000
4717+
- run-spec-benchmark-tests-node-server-timeoutMS-0
46734718
- name: rhel80-large-gallium
46744719
display_name: rhel8 Node16
46754720
run_on: rhel80-large

.evergreen/run-benchmarks.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ set -o nounset
77
source $DRIVERS_TOOLS/.evergreen/init-node-and-npm-env.sh
88

99
export MONGODB_URI=$MONGODB_URI
10+
export MONGODB_CLIENT_OPTIONS=$MONGODB_CLIENT_OPTIONS
1011

1112
npm run build:ts
1213
npm run check:bench

test/benchmarks/driverBench/common.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,22 @@ function loadSpecString(filePath) {
2323
return loadSpecFile(filePath, 'utf8');
2424
}
2525

26+
const MONGODB_CLIENT_OPTIONS = (() => {
27+
const optionsString = process.env.MONGODB_CLIENT_OPTIONS;
28+
let options = undefined;
29+
if (optionsString?.length) {
30+
options = JSON.parse(optionsString);
31+
}
32+
return { ...options };
33+
})();
34+
35+
const MONGODB_URI = (() => {
36+
if (process.env.MONGODB_URI?.length) return process.env.MONGODB_URI;
37+
return 'mongodb://127.0.0.1:27017';
38+
})();
39+
2640
function makeClient() {
27-
this.client = new MongoClient(process.env.MONGODB_URI || 'mongodb://127.0.0.1:27017');
41+
this.client = new MongoClient(MONGODB_URI, MONGODB_CLIENT_OPTIONS);
2842
}
2943

3044
function connectClient() {
@@ -101,6 +115,8 @@ async function writeSingleByteFileToBucket() {
101115
}
102116

103117
module.exports = {
118+
MONGODB_URI,
119+
MONGODB_CLIENT_OPTIONS,
104120
makeClient,
105121
connectClient,
106122
disconnectClient,

test/benchmarks/driverBench/index.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ const Runner = MongoBench.Runner;
88
let bsonType = 'js-bson';
99
// TODO(NODE-4606): test against different driver configurations in CI
1010

11-
const { inspect } = require('util');
1211
const { writeFile } = require('fs/promises');
1312
const { makeParallelBenchmarks, makeSingleBench, makeMultiBench } = require('../mongoBench/suites');
13+
const { MONGODB_CLIENT_OPTIONS } = require('./common');
1414

1515
const hw = os.cpus();
1616
const ram = os.totalmem() / 1024 ** 3;
@@ -89,15 +89,22 @@ benchmarkRunner
8989
return {
9090
info: {
9191
test_name: benchmarkName,
92-
tags: [bsonType]
92+
tags: [bsonType],
93+
// Args can only be a map of string -> int32. So if its a number leave it be,
94+
// if it is anything else test for truthiness and set to 1 or 0.
95+
args: Object.fromEntries(
96+
Object.entries(MONGODB_CLIENT_OPTIONS).map(([key, value]) => [
97+
key,
98+
typeof value === 'number' ? value | 0 : value ? 1 : 0
99+
])
100+
)
93101
},
94102
metrics: [{ name: 'megabytes_per_second', value: result }]
95103
};
96104
});
97105
})
98106
.then(data => {
99107
const results = JSON.stringify(data, undefined, 2);
100-
console.log(inspect(data, { depth: Infinity, colors: true }));
101108
return writeFile('results.json', results);
102109
})
103110
.catch(err => console.error(err));

test/benchmarks/mongoBench/runner.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,8 @@ class Runner {
190190

191191
_errorHandler(error) {
192192
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}`);
193+
for (let cause = error.cause; cause != null; cause = cause.cause) {
194+
this.reporter(`Caused by: ${cause.name} - ${cause.message} - ${cause.stack}`);
195195
}
196196
throw error;
197197
}

0 commit comments

Comments
 (0)