Skip to content

Commit

Permalink
chore(NODE-6459): compare CSOT performance (#4304)
Browse files Browse the repository at this point in the history
  • Loading branch information
nbbeeken authored Nov 8, 2024
1 parent 19ecf07 commit ed25d56
Show file tree
Hide file tree
Showing 6 changed files with 123 additions and 7 deletions.
49 changes: 48 additions & 1 deletion .evergreen/config.in.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1103,6 +1103,7 @@ functions:
PROJECT_DIRECTORY: ${PROJECT_DIRECTORY}
MONGODB_URI: ${MONGODB_URI}
DRIVERS_TOOLS: ${DRIVERS_TOOLS}
MONGODB_CLIENT_OPTIONS: ${MONGODB_CLIENT_OPTIONS}
binary: bash
args:
- ${PROJECT_DIRECTORY}/.evergreen/run-benchmarks.sh
Expand Down Expand Up @@ -1168,6 +1169,50 @@ tasks:
params:
file: src/results.json

- name: run-spec-benchmark-tests-node-server-timeoutMS-120000
tags:
- run-spec-benchmark-tests
- performance
exec_timeout_secs: 3600
commands:
- command: expansions.update
type: setup
params:
updates:
- { key: NODE_LTS_VERSION, value: v22.11.0 }
- { key: VERSION, value: v6.0-perf }
- { key: TOPOLOGY, value: server }
- { key: AUTH, value: noauth }
- { key: MONGODB_CLIENT_OPTIONS, value: '{"timeoutMS": 120000}' }
- func: install dependencies
- func: bootstrap mongo-orchestration
- func: run spec driver benchmarks
- command: perf.send
params:
file: src/results.json

- name: run-spec-benchmark-tests-node-server-timeoutMS-0
tags:
- run-spec-benchmark-tests
- performance
exec_timeout_secs: 3600
commands:
- command: expansions.update
type: setup
params:
updates:
- { key: NODE_LTS_VERSION, value: v22.11.0 }
- { key: VERSION, value: v6.0-perf }
- { key: TOPOLOGY, value: server }
- { key: AUTH, value: noauth }
- { key: MONGODB_CLIENT_OPTIONS, value: '{"timeoutMS": 0}' }
- func: install dependencies
- func: bootstrap mongo-orchestration
- func: run spec driver benchmarks
- command: perf.send
params:
file: src/results.json

- name: "test-gcpkms-task"
commands:
- command: expansions.update
Expand Down Expand Up @@ -1300,7 +1345,7 @@ tasks:
include_expansions_in_env: ["AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY", "AWS_SESSION_TOKEN"]
args:
- .evergreen/run-oidc-tests-k8s.sh

- name: "oidc-auth-test-k8s-latest-aks"
commands:
- func: "install dependencies"
Expand Down Expand Up @@ -1736,3 +1781,5 @@ buildvariants:
run_on: rhel90-dbx-perf-large
tasks:
- run-spec-benchmark-tests-node-server
- run-spec-benchmark-tests-node-server-timeoutMS-120000
- run-spec-benchmark-tests-node-server-timeoutMS-0
45 changes: 45 additions & 0 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1065,6 +1065,7 @@ functions:
PROJECT_DIRECTORY: ${PROJECT_DIRECTORY}
MONGODB_URI: ${MONGODB_URI}
DRIVERS_TOOLS: ${DRIVERS_TOOLS}
MONGODB_CLIENT_OPTIONS: ${MONGODB_CLIENT_OPTIONS}
binary: bash
args:
- ${PROJECT_DIRECTORY}/.evergreen/run-benchmarks.sh
Expand Down Expand Up @@ -1128,6 +1129,48 @@ tasks:
- command: perf.send
params:
file: src/results.json
- name: run-spec-benchmark-tests-node-server-timeoutMS-120000
tags:
- run-spec-benchmark-tests
- performance
exec_timeout_secs: 3600
commands:
- command: expansions.update
type: setup
params:
updates:
- {key: NODE_LTS_VERSION, value: v22.11.0}
- {key: VERSION, value: v6.0-perf}
- {key: TOPOLOGY, value: server}
- {key: AUTH, value: noauth}
- {key: MONGODB_CLIENT_OPTIONS, value: '{"timeoutMS": 120000}'}
- func: install dependencies
- func: bootstrap mongo-orchestration
- func: run spec driver benchmarks
- command: perf.send
params:
file: src/results.json
- name: run-spec-benchmark-tests-node-server-timeoutMS-0
tags:
- run-spec-benchmark-tests
- performance
exec_timeout_secs: 3600
commands:
- command: expansions.update
type: setup
params:
updates:
- {key: NODE_LTS_VERSION, value: v22.11.0}
- {key: VERSION, value: v6.0-perf}
- {key: TOPOLOGY, value: server}
- {key: AUTH, value: noauth}
- {key: MONGODB_CLIENT_OPTIONS, value: '{"timeoutMS": 0}'}
- func: install dependencies
- func: bootstrap mongo-orchestration
- func: run spec driver benchmarks
- command: perf.send
params:
file: src/results.json
- name: test-gcpkms-task
commands:
- command: expansions.update
Expand Down Expand Up @@ -4670,6 +4713,8 @@ buildvariants:
run_on: rhel90-dbx-perf-large
tasks:
- run-spec-benchmark-tests-node-server
- run-spec-benchmark-tests-node-server-timeoutMS-120000
- run-spec-benchmark-tests-node-server-timeoutMS-0
- name: rhel80-large-gallium
display_name: rhel8 Node16
run_on: rhel80-large
Expand Down
1 change: 1 addition & 0 deletions .evergreen/run-benchmarks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ set -o nounset
source $DRIVERS_TOOLS/.evergreen/init-node-and-npm-env.sh

export MONGODB_URI=$MONGODB_URI
export MONGODB_CLIENT_OPTIONS=$MONGODB_CLIENT_OPTIONS

npm run build:ts
npm run check:bench
18 changes: 17 additions & 1 deletion test/benchmarks/driverBench/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,22 @@ function loadSpecString(filePath) {
return loadSpecFile(filePath, 'utf8');
}

const MONGODB_CLIENT_OPTIONS = (() => {
const optionsString = process.env.MONGODB_CLIENT_OPTIONS;
let options = undefined;
if (optionsString?.length) {
options = JSON.parse(optionsString);
}
return { ...options };
})();

const MONGODB_URI = (() => {
if (process.env.MONGODB_URI?.length) return process.env.MONGODB_URI;
return 'mongodb://127.0.0.1:27017';
})();

function makeClient() {
this.client = new MongoClient(process.env.MONGODB_URI || 'mongodb://127.0.0.1:27017');
this.client = new MongoClient(MONGODB_URI, MONGODB_CLIENT_OPTIONS);
}

function connectClient() {
Expand Down Expand Up @@ -101,6 +115,8 @@ async function writeSingleByteFileToBucket() {
}

module.exports = {
MONGODB_URI,
MONGODB_CLIENT_OPTIONS,
makeClient,
connectClient,
disconnectClient,
Expand Down
13 changes: 10 additions & 3 deletions test/benchmarks/driverBench/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ const Runner = MongoBench.Runner;
let bsonType = 'js-bson';
// TODO(NODE-4606): test against different driver configurations in CI

const { inspect } = require('util');
const { writeFile } = require('fs/promises');
const { makeParallelBenchmarks, makeSingleBench, makeMultiBench } = require('../mongoBench/suites');
const { MONGODB_CLIENT_OPTIONS } = require('./common');

const hw = os.cpus();
const ram = os.totalmem() / 1024 ** 3;
Expand Down Expand Up @@ -89,15 +89,22 @@ benchmarkRunner
return {
info: {
test_name: benchmarkName,
tags: [bsonType]
tags: [bsonType],
// Args can only be a map of string -> int32. So if its a number leave it be,
// if it is anything else test for truthiness and set to 1 or 0.
args: Object.fromEntries(
Object.entries(MONGODB_CLIENT_OPTIONS).map(([key, value]) => [
key,
typeof value === 'number' ? value | 0 : value ? 1 : 0
])
)
},
metrics: [{ name: 'megabytes_per_second', value: result }]
};
});
})
.then(data => {
const results = JSON.stringify(data, undefined, 2);
console.log(inspect(data, { depth: Infinity, colors: true }));
return writeFile('results.json', results);
})
.catch(err => console.error(err));
4 changes: 2 additions & 2 deletions test/benchmarks/mongoBench/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ class Runner {

_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}`);
for (let cause = error.cause; cause != null; cause = cause.cause) {
this.reporter(`Caused by: ${cause.name} - ${cause.message} - ${cause.stack}`);
}
throw error;
}
Expand Down

0 comments on commit ed25d56

Please sign in to comment.