Skip to content

Commit 87997f8

Browse files
committed
Improve benchmark test.
Signed-off-by: Arris Ray <arris.ray+github@gmail.com>
1 parent 71c11cb commit 87997f8

File tree

2 files changed

+211
-174
lines changed

2 files changed

+211
-174
lines changed

tests/Test/Benchmark/BenchmarkTest.php

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,10 @@ class BenchmarkTest extends TestCase
1919
*/
2020
public static function setUpBeforeClass(): void
2121
{
22-
file_put_contents(self::RESULT_FILENAME, implode(',', [
23-
'adapter',
24-
'metric',
25-
'num-keys',
26-
'num-samples',
27-
'write-p50',
28-
'write-p75',
29-
'write-p95',
30-
'write-p99',
31-
'write-min',
32-
'write-max',
33-
'write-avg',
34-
'render-p50',
35-
'render-p75',
36-
'render-p95',
37-
'render-p99',
38-
'render-min',
39-
'render-max',
40-
'render-avg',
41-
]));
22+
file_put_contents(
23+
self::RESULT_FILENAME,
24+
implode(',', TestCaseResult::getCsvHeaders())
25+
);
4226
parent::setUpBeforeClass();
4327
}
4428

@@ -48,10 +32,34 @@ public static function setUpBeforeClass(): void
4832
public function benchmarkProvider(): array
4933
{
5034
return [
35+
[AdapterType::REDISNG, MetricType::COUNTER, 1000, 10],
36+
[AdapterType::REDISNG, MetricType::COUNTER, 2000, 10],
37+
[AdapterType::REDISNG, MetricType::COUNTER, 5000, 10],
38+
[AdapterType::REDISNG, MetricType::COUNTER, 10000, 10],
39+
[AdapterType::REDISNG, MetricType::GAUGE, 1000, 10],
40+
[AdapterType::REDISNG, MetricType::GAUGE, 2000, 10],
41+
[AdapterType::REDISNG, MetricType::GAUGE, 5000, 10],
42+
[AdapterType::REDISNG, MetricType::GAUGE, 10000, 10],
43+
[AdapterType::REDISNG, MetricType::HISTOGRAM, 1000, 10],
44+
[AdapterType::REDISNG, MetricType::HISTOGRAM, 2000, 10],
45+
[AdapterType::REDISNG, MetricType::HISTOGRAM, 5000, 10],
46+
[AdapterType::REDISNG, MetricType::HISTOGRAM, 10000, 10],
5147
[AdapterType::REDISNG, MetricType::SUMMARY, 1000, 10],
5248
[AdapterType::REDISNG, MetricType::SUMMARY, 2000, 10],
5349
[AdapterType::REDISNG, MetricType::SUMMARY, 5000, 10],
5450
[AdapterType::REDISNG, MetricType::SUMMARY, 10000, 10],
51+
[AdapterType::REDISTXN, MetricType::COUNTER, 1000, 10],
52+
[AdapterType::REDISTXN, MetricType::COUNTER, 2000, 10],
53+
[AdapterType::REDISTXN, MetricType::COUNTER, 5000, 10],
54+
[AdapterType::REDISTXN, MetricType::COUNTER, 10000, 10],
55+
[AdapterType::REDISTXN, MetricType::GAUGE, 1000, 10],
56+
[AdapterType::REDISTXN, MetricType::GAUGE, 2000, 10],
57+
[AdapterType::REDISTXN, MetricType::GAUGE, 5000, 10],
58+
[AdapterType::REDISTXN, MetricType::GAUGE, 10000, 10],
59+
[AdapterType::REDISTXN, MetricType::HISTOGRAM, 1000, 10],
60+
[AdapterType::REDISTXN, MetricType::HISTOGRAM, 2000, 10],
61+
[AdapterType::REDISTXN, MetricType::HISTOGRAM, 5000, 10],
62+
[AdapterType::REDISTXN, MetricType::HISTOGRAM, 10000, 10],
5563
[AdapterType::REDISTXN, MetricType::SUMMARY, 1000, 10],
5664
[AdapterType::REDISTXN, MetricType::SUMMARY, 2000, 10],
5765
[AdapterType::REDISTXN, MetricType::SUMMARY, 5000, 10],
@@ -76,6 +84,8 @@ public function benchmark(
7684
int $numSamples
7785
): void
7886
{
87+
ini_set('memory_limit','1024M');
88+
7989
// Create and execute test case
8090
$testCase = BenchmarkTestCase::newBuilder()
8191
->withAdapterType($adapter)

0 commit comments

Comments
 (0)