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

qe: add json serialization span in binary engine #4339

Merged
merged 7 commits into from
Apr 10, 2024

Conversation

aqrln
Copy link
Member

@aqrln aqrln commented Oct 6, 2023

The equivalent of #4154 for the binary engine.

Closes: prisma/prisma#21405

The equivalent of #4154 and
#4336 for the binary
engine.

Closes: prisma/prisma#21405
@aqrln aqrln requested a review from a team as a code owner October 6, 2023 23:03
@aqrln aqrln marked this pull request as draft October 6, 2023 23:03
@codspeed-hq
Copy link

codspeed-hq bot commented Oct 6, 2023

CodSpeed Performance Report

Merging #4339 will degrade performances by 5.33%

Comparing qe-add-json-seriaization-span-in-binary-engine (d747472) with main (87bc6b8)

Summary

❌ 1 regressions
✅ 10 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark main qe-add-json-seriaization-span-in-binary-engine Change
large_read 7.7 ms 8.1 ms -5.33%

@janpio janpio changed the title qe: add json seriaization span in binary engine qe: add json serialization span in binary engine Oct 6, 2023
@aqrln aqrln marked this pull request as ready for review October 9, 2023 14:16
@aqrln aqrln added this to the 5.5.0 milestone Oct 9, 2023
@aqrln aqrln requested a review from a team as a code owner January 19, 2024 11:17
@aqrln aqrln requested review from miguelff and Druue and removed request for a team January 19, 2024 11:17
Copy link
Contributor

github-actions bot commented Jan 19, 2024

WASM Query Engine file Size

Engine This PR Base branch Diff
Postgres 2.124MiB 2.124MiB 0.000B
Postgres (gzip) 836.396KiB 836.392KiB 4.000B
Mysql 2.092MiB 2.092MiB 0.000B
Mysql (gzip) 823.310KiB 823.307KiB 3.000B
Sqlite 1.988MiB 1.988MiB 0.000B
Sqlite (gzip) 784.003KiB 784.001KiB 2.000B

Copy link
Contributor

github-actions bot commented Jan 19, 2024

✅ WASM query-engine performance won't change substantially (0.994x)

Full benchmark report
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/bench?schema=imdb_bench&sslmode=disable" \
node --experimental-wasm-modules query-engine/driver-adapters/executor/dist/bench.mjs
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
cpu: AMD EPYC 7763 64-Core Processor
runtime: node v18.20.1 (x64-linux)

benchmark                   time (avg)             (min … max)       p75       p99      p999
-------------------------------------------------------------- -----------------------------
• movies.findMany() (all - ~50K)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline     371 ms/iter       (369 ms … 372 ms)    372 ms    372 ms    372 ms
Web Assembly: Latest       469 ms/iter       (465 ms … 473 ms)    471 ms    473 ms    473 ms
Web Assembly: Current      465 ms/iter       (461 ms … 468 ms)    468 ms    468 ms    468 ms
Node API: Current          199 ms/iter       (191 ms … 205 ms)    205 ms    205 ms    205 ms

summary for movies.findMany() (all - ~50K)
  Web Assembly: Current
   2.34x slower than Node API: Current
   1.25x slower than Web Assembly: Baseline
   1.01x faster than Web Assembly: Latest

• movies.findMany({ take: 2000 })
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline  15'236 µs/iter (14'883 µs … 16'168 µs) 15'331 µs 16'168 µs 16'168 µs
Web Assembly: Latest    19'031 µs/iter (18'822 µs … 19'451 µs) 19'081 µs 19'451 µs 19'451 µs
Web Assembly: Current   19'086 µs/iter (18'811 µs … 19'869 µs) 19'123 µs 19'869 µs 19'869 µs
Node API: Current        8'485 µs/iter   (8'212 µs … 9'090 µs)  8'606 µs  9'090 µs  9'090 µs

summary for movies.findMany({ take: 2000 })
  Web Assembly: Current
   2.25x slower than Node API: Current
   1.25x slower than Web Assembly: Baseline
   1x faster than Web Assembly: Latest

• movies.findMany({ where: {...}, take: 2000 })
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline   2'337 µs/iter   (2'203 µs … 3'353 µs)  2'329 µs  3'253 µs  3'353 µs
Web Assembly: Latest     2'948 µs/iter   (2'821 µs … 3'748 µs)  2'944 µs  3'295 µs  3'748 µs
Web Assembly: Current    2'931 µs/iter   (2'799 µs … 3'707 µs)  2'920 µs  3'623 µs  3'707 µs
Node API: Current        1'457 µs/iter   (1'330 µs … 3'502 µs)  1'439 µs  2'314 µs  3'502 µs

summary for movies.findMany({ where: {...}, take: 2000 })
  Web Assembly: Current
   2.01x slower than Node API: Current
   1.25x slower than Web Assembly: Baseline
   1.01x faster than Web Assembly: Latest

• movies.findMany({ include: { cast: true } take: 2000 }) (m2m)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline     579 ms/iter       (572 ms … 595 ms)    583 ms    595 ms    595 ms
Web Assembly: Latest       793 ms/iter       (790 ms … 796 ms)    796 ms    796 ms    796 ms
Web Assembly: Current      789 ms/iter       (783 ms … 794 ms)    791 ms    794 ms    794 ms
Node API: Current          492 ms/iter       (461 ms … 520 ms)    512 ms    520 ms    520 ms

summary for movies.findMany({ include: { cast: true } take: 2000 }) (m2m)
  Web Assembly: Current
   1.6x slower than Node API: Current
   1.36x slower than Web Assembly: Baseline
   1.01x faster than Web Assembly: Latest

• movies.findMany({ where: {...}, include: { cast: true } take: 2000 }) (m2m)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline  81'320 µs/iter (80'882 µs … 81'825 µs) 81'717 µs 81'825 µs 81'825 µs
Web Assembly: Latest       113 ms/iter       (113 ms … 114 ms)    113 ms    114 ms    114 ms
Web Assembly: Current      114 ms/iter       (112 ms … 124 ms)    113 ms    124 ms    124 ms
Node API: Current       65'522 µs/iter (65'003 µs … 66'052 µs) 65'804 µs 66'052 µs 66'052 µs

summary for movies.findMany({ where: {...}, include: { cast: true } take: 2000 }) (m2m)
  Web Assembly: Current
   1.74x slower than Node API: Current
   1.4x slower than Web Assembly: Baseline
   1.01x slower than Web Assembly: Latest

• movies.findMany({ take: 2000, include: { cast: { include: { person: true } } } })
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline   1'016 ms/iter   (1'011 ms … 1'022 ms)  1'019 ms  1'022 ms  1'022 ms
Web Assembly: Latest     1'324 ms/iter   (1'317 ms … 1'342 ms)  1'327 ms  1'342 ms  1'342 ms
Web Assembly: Current    1'312 ms/iter   (1'301 ms … 1'322 ms)  1'316 ms  1'322 ms  1'322 ms
Node API: Current          885 ms/iter       (856 ms … 920 ms)    911 ms    920 ms    920 ms

summary for movies.findMany({ take: 2000, include: { cast: { include: { person: true } } } })
  Web Assembly: Current
   1.48x slower than Node API: Current
   1.29x slower than Web Assembly: Baseline
   1.01x faster than Web Assembly: Latest

• movie.findMany({ where: { ... }, take: 2000, include: { cast: { include: { person: true } } } })
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline     147 ms/iter       (147 ms … 148 ms)    148 ms    148 ms    148 ms
Web Assembly: Latest       192 ms/iter       (191 ms … 193 ms)    193 ms    193 ms    193 ms
Web Assembly: Current      190 ms/iter       (188 ms … 195 ms)    191 ms    195 ms    195 ms
Node API: Current          119 ms/iter       (118 ms … 121 ms)    120 ms    121 ms    121 ms

summary for movie.findMany({ where: { ... }, take: 2000, include: { cast: { include: { person: true } } } })
  Web Assembly: Current
   1.59x slower than Node API: Current
   1.29x slower than Web Assembly: Baseline
   1.01x faster than Web Assembly: Latest

• movie.findMany({ where: { reviews: { author: { ... } }, take: 100 }) (to-many -> to-one)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline   1'055 µs/iter     (977 µs … 1'733 µs)  1'051 µs  1'633 µs  1'733 µs
Web Assembly: Latest     1'415 µs/iter   (1'337 µs … 2'187 µs)  1'421 µs  1'917 µs  2'187 µs
Web Assembly: Current    1'407 µs/iter   (1'325 µs … 2'027 µs)  1'411 µs  1'890 µs  2'027 µs
Node API: Current          786 µs/iter     (708 µs … 1'417 µs)    799 µs    975 µs  1'417 µs

summary for movie.findMany({ where: { reviews: { author: { ... } }, take: 100 }) (to-many -> to-one)
  Web Assembly: Current
   1.79x slower than Node API: Current
   1.33x slower than Web Assembly: Baseline
   1.01x faster than Web Assembly: Latest

• movie.findMany({ where: { cast: { person: { ... } }, take: 100 }) (m2m -> to-one)
-------------------------------------------------------------- -----------------------------
Web Assembly: Baseline   1'050 µs/iter     (979 µs … 1'824 µs)  1'045 µs  1'691 µs  1'824 µs
Web Assembly: Latest     1'397 µs/iter   (1'321 µs … 2'058 µs)  1'402 µs  1'889 µs  2'058 µs
Web Assembly: Current    1'393 µs/iter   (1'312 µs … 2'182 µs)  1'394 µs  1'902 µs  2'182 µs
Node API: Current          790 µs/iter     (715 µs … 1'334 µs)    805 µs    996 µs  1'334 µs

summary for movie.findMany({ where: { cast: { person: { ... } }, take: 100 }) (m2m -> to-one)
  Web Assembly: Current
   1.76x slower than Node API: Current
   1.33x slower than Web Assembly: Baseline
   1x faster than Web Assembly: Latest

After changes in d747472

@aqrln
Copy link
Member Author

aqrln commented Apr 9, 2024

Extracted unrelated span parent changes to #4336, otherwise merging this approved PR was blocked by a dependency on an unapproved PR.

@aqrln aqrln merged commit fce8aba into main Apr 10, 2024
181 of 182 checks passed
@aqrln aqrln deleted the qe-add-json-seriaization-span-in-binary-engine branch April 10, 2024 09:44
aqrln added a commit that referenced this pull request Apr 10, 2024
jkomyno pushed a commit that referenced this pull request Apr 11, 2024
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.

Add prisma:engine:response_json_serialization span in binary engine
3 participants