Skip to content

Commit db2ed88

Browse files
committed
Remove bench with write concern 0 as tests needs to be run on standalone server
1 parent e72b632 commit db2ed88

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

benchmark/DriverBench/SingleDocBench.php

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
use MongoDB\Benchmark\BaseBench;
77
use MongoDB\BSON\Document;
88
use MongoDB\Driver\Command;
9-
use MongoDB\Driver\WriteConcern;
109
use PhpBench\Attributes\BeforeMethods;
1110
use PhpBench\Attributes\ParamProviders;
1211
use PhpBench\Attributes\Revs;
@@ -15,7 +14,11 @@
1514
use function file_get_contents;
1615
use function range;
1716

18-
/** @see https://github.com/mongodb/specifications/blob/ddfc8b583d49aaf8c4c19fa01255afb66b36b92e/source/benchmarking/benchmarking.rst#single-doc-benchmarks */
17+
/**
18+
* For accurate results, run benchmarks on a standalone server.
19+
*
20+
* @see https://github.com/mongodb/specifications/blob/ddfc8b583d49aaf8c4c19fa01255afb66b36b92e/source/benchmarking/benchmarking.rst#single-doc-benchmarks
21+
*/
1922
#[BeforeMethods('prepareDatabase')]
2023
final class SingleDocBench extends BaseBench
2124
{
@@ -28,9 +31,10 @@ public function prepareDatabase(): void
2831
public function benchRunCommand(): void
2932
{
3033
$manager = self::createClient()->getManager();
34+
$database = self::getDatabase();
3135

3236
for ($i = 0; $i < 10_000; $i++) {
33-
$manager->executeCommand(self::getDatabase(), new Command(['hello' => true]));
37+
$manager->executeCommand($database, new Command(['hello' => true]));
3438
}
3539
}
3640

@@ -96,12 +100,6 @@ public static function provideInsertOneParams(): Generator
96100
'repeat' => 10_000,
97101
];
98102

99-
yield 'Small doc WC 0' => [
100-
'document' => self::readJsonFile(self::SMALL_FILE_PATH),
101-
'repeat' => 10_000,
102-
'options' => ['writeConcern' => new WriteConcern(0)],
103-
];
104-
105103
yield 'Large doc' => [
106104
'document' => self::readJsonFile(self::LARGE_FILE_PATH),
107105
'repeat' => 10,
@@ -111,11 +109,5 @@ public static function provideInsertOneParams(): Generator
111109
'document' => Document::fromJSON(file_get_contents(self::LARGE_FILE_PATH)),
112110
'repeat' => 10,
113111
];
114-
115-
yield 'Large doc WC 0' => [
116-
'document' => Document::fromJSON(file_get_contents(self::LARGE_FILE_PATH)),
117-
'repeat' => 10,
118-
'options' => ['writeConcern' => new WriteConcern(0)],
119-
];
120112
}
121113
}

0 commit comments

Comments
 (0)