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

test(qe-wasm): WASM query engine benchmarks isolated from DB #4567

Merged
merged 42 commits into from Dec 19, 2023

Conversation

miguelff
Copy link
Contributor

@miguelff miguelff commented Dec 14, 2023

The present PR adds continuous benchmarking of the current query-engine WASM, comparing it with:

  • NAPI on the same branch
  • WASM in main
  • WASM baseline (at the beginning of our performance inquiries)

It provides a comment like this with the benchmark results for different queries in text mode.

Benchmarks are considered to have regressed if there is more than one benchmark 5% slower in the current WASM query engine compared to the latest version (coming from main)

Close https://github.com/prisma/team-orm/issues/725
Close https://github.com/prisma/team-orm/issues/732
Close https://github.com/prisma/team-orm/issues/733
Close https://github.com/prisma/team-orm/issues/734

Implementation:

The code uses a decorator over the driver adapter that fetches query results from a local cache after warmup, in a way such as the database IO latency is a no-op.

The queries to benchmark are defined in the queries.json file. Once this PR is reviewed for a correct approach and implementation, we can add more queries the query-benchmarks suite if necessary.

Copy link
Contributor

github-actions bot commented Dec 14, 2023

WASM Size

Engine This PR Base branch Diff
WASM 3.133MiB 3.133MiB 0.000B
WASM (gzip) 1.184MiB 1.184MiB 0.000B

Copy link

codspeed-hq bot commented Dec 14, 2023

CodSpeed Performance Report

Merging #4567 will not alter performance

Comparing da-benchmarks (ee4fc7a) with main (e78ce01)

Summary

✅ 11 untouched benchmarks

Comment on lines +148 to +152
start-pg-bench:
docker compose -f query-engine/driver-adapters/executor/bench/docker-compose.yml up --wait -d --remove-orphans postgres
Copy link
Contributor Author

Choose a reason for hiding this comment

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

query-engine/driver-adapters/executor/script/bench.sh Outdated Show resolved Hide resolved
query-engine/driver-adapters/executor/src/bench.ts Outdated Show resolved Hide resolved
query-engine/driver-adapters/executor/src/bench.ts Outdated Show resolved Hide resolved
query-engine/driver-adapters/executor/src/qe.ts Outdated Show resolved Hide resolved
query-engine/driver-adapters/executor/src/recordReplay.ts Outdated Show resolved Hide resolved
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup, quite large. The alternatives are:

  1. Store this file in a different place in the internet and pull it (ex. a dedicated repository)
  2. Seed the database each time benchmark runs (10s -> 5 minutes)

@miguelff miguelff force-pushed the da-benchmarks branch 2 times, most recently from 03fed65 to 0c63fac Compare December 15, 2023 12:32
@miguelff miguelff added this to the 5.8.0 milestone Dec 15, 2023
@miguelff miguelff force-pushed the da-benchmarks branch 3 times, most recently from cfe897b to 29ff6a2 Compare December 15, 2023 14:20
@miguelff miguelff marked this pull request as ready for review December 15, 2023 14:20
@miguelff miguelff requested a review from a team as a code owner December 15, 2023 14:20
@miguelff miguelff requested review from ospfranco and Weakky and removed request for a team December 15, 2023 14:20
@miguelff miguelff marked this pull request as draft December 15, 2023 14:21
@miguelff miguelff force-pushed the da-benchmarks branch 7 times, most recently from 1bca2e3 to 5b07aa2 Compare December 15, 2023 15:38
@prisma prisma deleted a comment from github-actions bot Dec 18, 2023
@prisma prisma deleted a comment from github-actions bot Dec 18, 2023
@prisma prisma deleted a comment from github-actions bot Dec 18, 2023
@miguelff miguelff changed the title WIP: Record Replay decorator and benches test(qe-wasm): WASM query engine benchmarks isolated from DB Dec 18, 2023
@miguelff miguelff force-pushed the da-benchmarks branch 3 times, most recently from d2c2726 to 243b063 Compare December 18, 2023 14:38
@miguelff
Copy link
Contributor Author

@janpio Did you try to mean "Format the json file?" 😂

@miguelff
Copy link
Contributor Author

Thank you for the feedback @SevInf and @jkomyno I have addressed it and also decrease the tolerance of the benchmarks to 1% to consider it a regression.

@miguelff miguelff merged commit 1124898 into main Dec 19, 2023
66 checks passed
@miguelff miguelff deleted the da-benchmarks branch December 19, 2023 13:10
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.

None yet

4 participants