2
2
3
3
const MongoBench = require ( '../mongoBench' ) ;
4
4
const os = require ( 'node:os' ) ;
5
- const util = require ( 'node:util' ) ;
6
5
const process = require ( 'node:process' ) ;
7
6
8
7
const Runner = MongoBench . Runner ;
@@ -11,18 +10,8 @@ let bsonType = 'js-bson';
11
10
// TODO(NODE-4606): test against different driver configurations in CI
12
11
13
12
const { writeFile } = require ( 'fs/promises' ) ;
14
- const {
15
- makeParallelBenchmarks /* makeSingleBench, makeMultiBench */
16
- } = require ( '../mongoBench/suites' ) ;
17
- const {
18
- MONGODB_CLIENT_OPTIONS ,
19
- MONGODB_DRIVER_PATH ,
20
- MONGODB_DRIVER_VERSION ,
21
- MONGODB_DRIVER_REVISION ,
22
- MONGODB_BSON_PATH ,
23
- MONGODB_BSON_VERSION ,
24
- MONGODB_BSON_REVISION
25
- } = require ( './common' ) ;
13
+ const { makeParallelBenchmarks, makeSingleBench, makeMultiBench } = require ( '../mongoBench/suites' ) ;
14
+ const { MONGODB_CLIENT_OPTIONS } = require ( './common' ) ;
26
15
27
16
const hw = os . cpus ( ) ;
28
17
const ram = os . totalmem ( ) / 1024 ** 3 ;
@@ -35,10 +24,7 @@ const systemInfo = () =>
35
24
`- arch: ${ os . arch ( ) } ` ,
36
25
`- os: ${ process . platform } (${ os . release ( ) } )` ,
37
26
`- ram: ${ platform . ram } ` ,
38
- `- node: ${ process . version } ` ,
39
- `- driver: ${ MONGODB_DRIVER_VERSION } (${ MONGODB_DRIVER_REVISION } ): ${ MONGODB_DRIVER_PATH } ` ,
40
- ` - options ${ util . inspect ( MONGODB_CLIENT_OPTIONS ) } ` ,
41
- `- bson: ${ MONGODB_BSON_VERSION } (${ MONGODB_BSON_REVISION } ): (${ MONGODB_BSON_PATH } )\n`
27
+ `- node: ${ process . version } \n`
42
28
] . join ( '\n' ) ;
43
29
console . log ( systemInfo ( ) ) ;
44
30
@@ -47,19 +33,23 @@ function average(arr) {
47
33
}
48
34
49
35
const benchmarkRunner = new Runner ( )
50
- // .suite('singleBench', suite => makeSingleBench(suite))
51
- // .suite('multiBench', suite => makeMultiBench(suite))
36
+ . suite ( 'singleBench' , suite => makeSingleBench ( suite ) )
37
+ . suite ( 'multiBench' , suite => makeMultiBench ( suite ) )
52
38
. suite ( 'parallel' , suite => makeParallelBenchmarks ( suite ) ) ;
53
39
54
40
benchmarkRunner
55
41
. run ( )
56
42
. then ( microBench => {
57
- // const singleBench = average([
58
- // microBench.singleBench.findOne,
59
- // microBench.singleBench.smallDocInsertOne,
60
- // microBench.singleBench.largeDocInsertOne
61
- // ]);
62
- // const multiBench = average(Object.values(microBench.multiBench));
43
+ const singleBench = average ( [
44
+ microBench . singleBench . findOne ,
45
+ microBench . singleBench . smallDocInsertOne ,
46
+ microBench . singleBench . largeDocInsertOne
47
+ ] ) ;
48
+ const multiBench = average ( Object . values ( microBench . multiBench ) ) ;
49
+
50
+ // ldjsonMultiFileUpload and ldjsonMultiFileExport cause connection errors.
51
+ // While we investigate, we will use the last known good values:
52
+ // https://spruce.mongodb.com/task/mongo_node_driver_next_performance_tests_run_spec_benchmark_tests_node_server_4bc3e500b6f0e8ab01f052c4a1bfb782d6a29b4e_f168e1328f821bbda265e024cc91ae54_24_11_18_15_37_24/logs?execution=0
63
53
64
54
const parallelBench = average ( [
65
55
microBench . parallel . ldjsonMultiFileUpload ,
@@ -69,27 +59,27 @@ benchmarkRunner
69
59
] ) ;
70
60
71
61
const readBench = average ( [
72
- // microBench.singleBench.findOne,
73
- // microBench.multiBench.findManyAndEmptyCursor,
74
- // microBench.multiBench.gridFsDownload,
62
+ microBench . singleBench . findOne ,
63
+ microBench . multiBench . findManyAndEmptyCursor ,
64
+ microBench . multiBench . gridFsDownload ,
75
65
microBench . parallel . gridfsMultiFileDownload ,
76
66
microBench . parallel . ldjsonMultiFileExport
77
67
] ) ;
78
68
const writeBench = average ( [
79
- // microBench.singleBench.smallDocInsertOne,
80
- // microBench.singleBench.largeDocInsertOne,
81
- // microBench.multiBench.smallDocBulkInsert,
82
- // microBench.multiBench.largeDocBulkInsert,
83
- // microBench.multiBench.gridFsUpload,
69
+ microBench . singleBench . smallDocInsertOne ,
70
+ microBench . singleBench . largeDocInsertOne ,
71
+ microBench . multiBench . smallDocBulkInsert ,
72
+ microBench . multiBench . largeDocBulkInsert ,
73
+ microBench . multiBench . gridFsUpload ,
84
74
microBench . parallel . ldjsonMultiFileUpload ,
85
75
microBench . parallel . gridfsMultiFileUpload
86
76
] ) ;
87
77
88
78
const driverBench = average ( [ readBench , writeBench ] ) ;
89
79
90
80
const benchmarkResults = {
91
- // singleBench,
92
- // multiBench,
81
+ singleBench,
82
+ multiBench,
93
83
parallelBench,
94
84
readBench,
95
85
writeBench,
@@ -123,6 +113,6 @@ benchmarkRunner
123
113
return writeFile ( 'results.json' , results ) ;
124
114
} )
125
115
. catch ( err => {
126
- console . error ( 'failure: ' , err . name , err . message , err . stack ) ;
116
+ console . error ( 'failure: ' , err . name , err . message ) ;
127
117
process . exit ( 1 ) ;
128
118
} ) ;
0 commit comments