Skip to content

Commit 7a37fd8

Browse files
committed
review comments
1 parent 91b3948 commit 7a37fd8

File tree

8 files changed

+19
-453
lines changed

8 files changed

+19
-453
lines changed

test/benchmarks/driverBench/common.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,6 @@ function makeClient() {
2727
this.client = new MongoClient(process.env.MONGODB_URI || 'mongodb://127.0.0.1:27017');
2828
}
2929

30-
function makeCSOTClient() {
31-
this.client = new MongoClient(process.env.MONGODB_URI || 'mongodb://127.0.0.1:27017', {
32-
timeoutMS: 0
33-
});
34-
}
35-
3630
function connectClient() {
3731
return this.client.connect();
3832
}
@@ -108,7 +102,6 @@ async function writeSingleByteFileToBucket() {
108102

109103
module.exports = {
110104
makeClient,
111-
makeCSOTClient,
112105
connectClient,
113106
disconnectClient,
114107
initDb,

test/benchmarks/driverBench/index.js

Lines changed: 3 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,7 @@ let bsonType = 'js-bson';
1010

1111
const { inspect } = require('util');
1212
const { writeFile } = require('fs/promises');
13-
const {
14-
makeParallelBenchmarks,
15-
makeSingleBench,
16-
makeMultiBench,
17-
makeCSOTSingleBench,
18-
makeCSOTMultiBench,
19-
makeCSOTParallelBenchmarks
20-
} = require('../mongoBench/suites');
13+
const { makeParallelBenchmarks, makeSingleBench, makeMultiBench } = require('../mongoBench/suites');
2114

2215
const hw = os.cpus();
2316
const ram = os.totalmem() / 1024 ** 3;
@@ -39,11 +32,8 @@ function average(arr) {
3932

4033
const benchmarkRunner = new Runner()
4134
.suite('singleBench', suite => makeSingleBench(suite))
42-
.suite('singleBenchCSOT', suite => makeCSOTSingleBench(suite))
4335
.suite('multiBench', suite => makeMultiBench(suite))
44-
.suite('multiBenchCSOT', suite => makeCSOTMultiBench(suite))
45-
.suite('parallel', suite => makeParallelBenchmarks(suite))
46-
.suite('parallelCSOT', suite => makeCSOTParallelBenchmarks(suite));
36+
.suite('parallel', suite => makeParallelBenchmarks(suite));
4737

4838
benchmarkRunner
4939
.run()
@@ -53,15 +43,7 @@ benchmarkRunner
5343
microBench.singleBench.smallDocInsertOne,
5444
microBench.singleBench.largeDocInsertOne
5545
]);
56-
57-
const singleBenchCSOT = average([
58-
microBench.singleBenchCSOT.findOne_timeoutMS_0,
59-
microBench.singleBenchCSOT.smallDocInsertOne_timeoutMS_0,
60-
microBench.singleBenchCSOT.largeDocInsertOne_timeoutMS_0
61-
]);
62-
6346
const multiBench = average(Object.values(microBench.multiBench));
64-
const multiBenchCSOT = average(Object.values(microBench.multiBenchCSOT));
6547

6648
const parallelBench = average([
6749
microBench.parallel.ldjsonMultiFileUpload,
@@ -70,29 +52,13 @@ benchmarkRunner
7052
microBench.parallel.gridfsMultiFileDownload
7153
]);
7254

73-
const parallelBenchCSOT = average([
74-
microBench.parallelCSOT.ldjsonMultiFileUpload_timeoutMS_0,
75-
microBench.parallelCSOT.ldjsonMultiFileExport_timeoutMS_0,
76-
microBench.parallelCSOT.gridfsMultiFileUpload_timeoutMS_0,
77-
microBench.parallelCSOT.gridfsMultiFileDownload_timeoutMS_0
78-
]);
79-
8055
const readBench = average([
8156
microBench.singleBench.findOne,
8257
microBench.multiBench.findManyAndEmptyCursor,
8358
microBench.multiBench.gridFsDownload,
8459
microBench.parallel.gridfsMultiFileDownload,
8560
microBench.parallel.ldjsonMultiFileExport
8661
]);
87-
88-
const readBenchCSOT = average([
89-
microBench.singleBenchCSOT.findOne_timeoutMS_0,
90-
microBench.multiBenchCSOT.findManyAndEmptyCursor_timeoutMS_0,
91-
microBench.multiBenchCSOT.gridFsDownload_timeoutMS_0,
92-
microBench.parallelCSOT.gridfsMultiFileDownload_timeoutMS_0,
93-
microBench.parallelCSOT.ldjsonMultiFileExport_timeoutMS_0
94-
]);
95-
9662
const writeBench = average([
9763
microBench.singleBench.smallDocInsertOne,
9864
microBench.singleBench.largeDocInsertOne,
@@ -103,31 +69,15 @@ benchmarkRunner
10369
microBench.parallel.gridfsMultiFileUpload
10470
]);
10571

106-
const writeBenchCSOT = average([
107-
microBench.singleBenchCSOT.smallDocInsertOne_timeoutMS_0,
108-
microBench.singleBenchCSOT.largeDocInsertOne_timeoutMS_0,
109-
microBench.multiBenchCSOT.smallDocBulkInsert_timeoutMS_0,
110-
microBench.multiBenchCSOT.largeDocBulkInsert_timeoutMS_0,
111-
microBench.multiBenchCSOT.gridFsUpload_timeoutMS_0,
112-
microBench.parallelCSOT.ldjsonMultiFileUpload_timeoutMS_0,
113-
microBench.parallelCSOT.gridfsMultiFileUpload_timeoutMS_0
114-
]);
115-
11672
const driverBench = average([readBench, writeBench]);
117-
const driverBenchCSOT = average([readBenchCSOT, writeBenchCSOT]);
73+
11874
const benchmarkResults = {
11975
singleBench,
120-
singleBenchCSOT,
12176
multiBench,
122-
multiBenchCSOT,
12377
parallelBench,
124-
parallelBenchCSOT,
12578
readBench,
126-
readBenchCSOT,
12779
writeBench,
128-
writeBenchCSOT,
12980
driverBench,
130-
driverBenchCSOT,
13181
...microBench.parallel,
13282
...microBench.bsonBench,
13383
...microBench.singleBench,
Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
const { makeParallelBenchmarks, makeCSOTParallelBenchmarks } = require('./parallelBench');
2-
const { makeSingleBench, makeCSOTSingleBench } = require('./singleBench');
3-
const { makeMultiBench, makeCSOTMultiBench } = require('./multiBench');
1+
const { makeParallelBenchmarks } = require('./parallelBench');
2+
const { makeSingleBench } = require('./singleBench');
3+
const { makeMultiBench } = require('./multiBench');
44

55
module.exports = {
66
makeParallelBenchmarks,
7-
makeCSOTParallelBenchmarks,
87
makeSingleBench,
9-
makeCSOTSingleBench,
10-
makeMultiBench,
11-
makeCSOTMultiBench
8+
makeMultiBench
129
};

test/benchmarks/mongoBench/suites/multiBench.js

Lines changed: 1 addition & 189 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ const {
44
loadSpecFile,
55
makeLoadJSON,
66
makeClient,
7-
makeCSOTClient,
87
connectClient,
98
initDb,
109
dropDb,
@@ -220,191 +219,4 @@ function makeMultiBench(suite) {
220219
);
221220
}
222221

223-
function makeCSOTMultiBench(suite) {
224-
return suite
225-
.benchmark('findManyAndEmptyCursor_timeoutMS_0', benchmark =>
226-
benchmark
227-
.taskSize(16.22)
228-
.setup(makeLoadJSON('tweet.json'))
229-
.setup(makeCSOTClient)
230-
.setup(connectClient)
231-
.setup(initDb)
232-
.setup(dropDb)
233-
.setup(initCollection)
234-
.setup(makeLoadTweets(false))
235-
.task(async function () {
236-
// eslint-disable-next-line no-unused-vars
237-
for await (const _ of this.collection.find({})) {
238-
// do nothing
239-
}
240-
})
241-
.teardown(dropDb)
242-
.teardown(disconnectClient)
243-
)
244-
.benchmark('smallDocBulkInsert_timeoutMS_0', benchmark =>
245-
benchmark
246-
.taskSize(2.75)
247-
.setup(makeLoadJSON('small_doc.json'))
248-
.setup(makeLoadInsertDocs(10000))
249-
.setup(makeCSOTClient)
250-
.setup(connectClient)
251-
.setup(initDb)
252-
.setup(dropDb)
253-
.setup(initDb)
254-
.setup(initCollection)
255-
.setup(createCollection)
256-
.beforeTask(dropCollection)
257-
.beforeTask(createCollection)
258-
.beforeTask(initCollection)
259-
.task(async function () {
260-
await this.collection.insertMany(this.docs, { ordered: true });
261-
})
262-
.teardown(dropDb)
263-
.teardown(disconnectClient)
264-
)
265-
.benchmark('largeDocBulkInsert_timeoutMS_0', benchmark =>
266-
benchmark
267-
.taskSize(27.31)
268-
.setup(makeLoadJSON('large_doc.json'))
269-
.setup(makeLoadInsertDocs(10))
270-
.setup(makeCSOTClient)
271-
.setup(connectClient)
272-
.setup(initDb)
273-
.setup(dropDb)
274-
.setup(initDb)
275-
.setup(initCollection)
276-
.setup(createCollection)
277-
.beforeTask(dropCollection)
278-
.beforeTask(createCollection)
279-
.beforeTask(initCollection)
280-
.task(async function () {
281-
await this.collection.insertMany(this.docs, { ordered: true });
282-
})
283-
.teardown(dropDb)
284-
.teardown(disconnectClient)
285-
)
286-
.benchmark('gridFsUpload_timeoutMS_0', benchmark =>
287-
benchmark
288-
.taskSize(52.43)
289-
.setup(loadGridFs)
290-
.setup(makeCSOTClient)
291-
.setup(connectClient)
292-
.setup(initDb)
293-
.setup(dropDb)
294-
.setup(initDb)
295-
.setup(initCollection)
296-
.beforeTask(dropBucket)
297-
.beforeTask(initBucket)
298-
.beforeTask(gridFsInitUploadStream)
299-
.beforeTask(writeSingleByteFileToBucket)
300-
.task(gridFsUpload)
301-
.teardown(dropDb)
302-
.teardown(disconnectClient)
303-
)
304-
.benchmark('gridFsDownload_timeoutMS_0', benchmark =>
305-
benchmark
306-
.taskSize(52.43)
307-
.setup(loadGridFs)
308-
.setup(makeCSOTClient)
309-
.setup(connectClient)
310-
.setup(initDb)
311-
.setup(dropDb)
312-
.setup(initDb)
313-
.setup(initCollection)
314-
.setup(dropBucket)
315-
.setup(initBucket)
316-
.setup(gridFsInitUploadStream)
317-
.setup(async function () {
318-
await gridFsUpload.call(this);
319-
this.id = this.uploadStream.id;
320-
this.uploadData = undefined;
321-
})
322-
.task(async function () {
323-
// eslint-disable-next-line no-unused-vars
324-
for await (const _ of this.bucket.openDownloadStream(this.id)) {
325-
// do nothing
326-
}
327-
})
328-
.teardown(dropDb)
329-
.teardown(disconnectClient)
330-
)
331-
.benchmark('findManyAndToArray_timeoutMS_0', benchmark =>
332-
benchmark
333-
.taskSize(16.22)
334-
.setup(makeLoadJSON('tweet.json'))
335-
.setup(makeCSOTClient)
336-
.setup(connectClient)
337-
.setup(initDb)
338-
.setup(dropDb)
339-
.setup(initCollection)
340-
.setup(makeLoadTweets(false))
341-
.task(async function () {
342-
await this.collection.find({}).toArray();
343-
})
344-
.teardown(dropDb)
345-
.teardown(disconnectClient)
346-
)
347-
.benchmark('aggregateAMillionDocumentsAndToArray_timeoutMS_0', benchmark =>
348-
benchmark
349-
.taskSize(16)
350-
.setup(makeCSOTClient)
351-
.setup(connectClient)
352-
.setup(initDb)
353-
.setup(dropDb)
354-
.task(async function () {
355-
await this.db
356-
.aggregate([
357-
{ $documents: [{}] },
358-
{
359-
$set: {
360-
field: {
361-
$reduce: {
362-
input: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19],
363-
initialValue: [0],
364-
in: { $concatArrays: ['$$value', '$$value'] }
365-
}
366-
}
367-
}
368-
},
369-
{ $unwind: '$field' },
370-
{ $limit: 1000000 }
371-
])
372-
.toArray();
373-
})
374-
.teardown(dropDb)
375-
.teardown(disconnectClient)
376-
)
377-
.benchmark('aggregateAMillionTweetsAndToArray_timeoutMS_0', benchmark =>
378-
benchmark
379-
.taskSize(1500)
380-
.setup(makeLoadJSON('tweet.json'))
381-
.setup(makeCSOTClient)
382-
.setup(connectClient)
383-
.setup(initDb)
384-
.setup(dropDb)
385-
.task(async function () {
386-
await this.db
387-
.aggregate([
388-
{ $documents: [this.doc] },
389-
{
390-
$set: {
391-
id: {
392-
$reduce: {
393-
input: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19],
394-
initialValue: [0],
395-
in: { $concatArrays: ['$$value', '$$value'] }
396-
}
397-
}
398-
}
399-
},
400-
{ $unwind: '$id' },
401-
{ $limit: 1000000 }
402-
])
403-
.toArray();
404-
})
405-
.teardown(dropDb)
406-
.teardown(disconnectClient)
407-
);
408-
}
409-
410-
module.exports = { makeMultiBench, makeCSOTMultiBench };
222+
module.exports = { makeMultiBench };

0 commit comments

Comments
 (0)