Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHPLIB-1187: Run benchmark on Evergreen #1185

Merged
merged 5 commits into from
Oct 30, 2023

Conversation

alcaeus
Copy link
Member

@alcaeus alcaeus commented Oct 20, 2023

PHPLIB-1187

This pull request adds a task to run benchmarks on Evergreen. It also uses perf.send to store benchmark metrics in CI so we can analyse the performance.

I've also removed a couple of benchmarks in order to bring the benchmark time down. Most recent tests show a 33 minute runtime on Evergreen. I also had to skip the AMP subjects as I ran into issues with socket creation. Since AMP does not perform significantly different from forking, I think it's safe to exclude them from the metrics we collect on Evergreen.

@alcaeus alcaeus requested a review from GromNaN October 20, 2023 08:09
@alcaeus alcaeus self-assigned this Oct 20, 2023
@@ -6,6 +6,5 @@
"runner.file_pattern": "*Bench.php",
"runner.path": "src",
"runner.php_config": { "memory_limit": "1G" },
"runner.iterations": 3,
"runner.revs": 10
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this in favour of increasing revs only for benchmarks that run in the microsecond range. For anything that takes milliseconds, the precision is usually good enough with a single rev.

@@ -74,15 +72,15 @@ public function afterIteration(): void
* Using a single thread to export multiple files.
* By executing a single Find command for multiple files, we can reduce the number of roundtrips to the server.
*
* @param array{chunk:int} $params
* @param array{chunkSize:int} $params
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decided to rename this since I got confused as to what chunk meant: I thought chunk: 1 meant a single chunk of files while it actually meant 100 chunks of 1 file each.

* @param array{chunk:int} $params
*/
#[ParamProviders(['provideChunkParams'])]
public function benchBulkWrite(array $params): void
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This subject essentially tests the same as benchInsertMany, so I decided to skip it in order to shave ~6 minutes off the run time.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could keep this and remove the other that is a little less efficient

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I removed bulkWrite and kept insertMany is that benchmarking the latter also exposes performance regressions introduced in the library, while the other only tests the extension.

Comment on lines +63 to +61
'created_at' => date(DATE_ATOM),
'completed_at' => date(DATE_ATOM),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this information is relevant to us, so I didn't bother trying to extract the exact dates. The documentation also didn't mark this as optional, so I decided to just include the current date instead.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, created_at could take $_SERVER['REQUEST_TIME'].

@alcaeus alcaeus force-pushed the phplib-1187-evg-benchmark branch from 40f013a to bbcc0f9 Compare October 20, 2023 08:14
Copy link
Member

@GromNaN GromNaN left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@@ -1 +1,2 @@
extension=mongodb.so
memory_limit=-1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should increase the limit. Otherwise we don't know how much memory is used if it's too much. What is the memory limit of the job runner?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason it aborted when it hit a previous 128M limit, apparently ignoring the 1G limit definer in the runner config. We can also report memory usage from the benchmarks using perf.send, which would be a better indicator than failing the build when it hits some limit. Want me to add those numbers?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perf.send is too late if the process crashes, no?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, perf.send would not be executed in that case. With -1 the memory would be unlimited, so the only case in which it would crash is if it used up all memory including the page file, which I'd consider highly unlikely.

Comment on lines +63 to +61
'created_at' => date(DATE_ATOM),
'completed_at' => date(DATE_ATOM),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, created_at could take $_SERVER['REQUEST_TIME'].

@alcaeus alcaeus merged commit 567cfe1 into mongodb:master Oct 30, 2023
13 checks passed
@alcaeus alcaeus deleted the phplib-1187-evg-benchmark branch October 30, 2023 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants