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

Response caching for batched requests #3759

Merged
merged 6 commits into from
Feb 14, 2025
Merged

Response caching for batched requests #3759

merged 6 commits into from
Feb 14, 2025

Conversation

enisdenjo
Copy link
Collaborator

@enisdenjo enisdenjo commented Feb 14, 2025

Ref GW-42
Fixes graphql-hive/gateway#494

Now the WeakMap uses the context instead of the request correctly returning the operation ID for each operation in a batched request.

Copy link

changeset-bot bot commented Feb 14, 2025

🦋 Changeset detected

Latest commit: 13d75d6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@graphql-yoga/plugin-response-cache Patch
hello-world-benchmark Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@enisdenjo enisdenjo changed the title Res cache batching Response caching for batched requests Feb 14, 2025
@enisdenjo enisdenjo requested review from ardatan and n1ru4l February 14, 2025 16:57
Copy link
Contributor

github-actions bot commented Feb 14, 2025

Apollo Federation Subgraph Compatibility Results

Federation 1 Support Federation 2 Support
_service🟢
@key (single)🟢
@key (multi)🟢
@key (composite)🟢
repeatable @key🟢
@requires🟢
@provides🟢
federated tracing🟢
@link🟢
@shareable🟢
@tag🟢
@override🟢
@inaccessible🟢
@composeDirective🟢
@interfaceObject🟢

Learn more:

Copy link
Contributor

github-actions bot commented Feb 14, 2025

💻 Website Preview

The latest changes are available as preview in: https://2b517601.graphql-yoga.pages.dev

Copy link
Contributor

github-actions bot commented Feb 14, 2025

✅ Benchmark Results

     ✓ no_errors{mode:graphql}
     ✓ expected_result{mode:graphql}
     ✓ no_errors{mode:graphql-jit}
     ✓ expected_result{mode:graphql-jit}
     ✓ no_errors{mode:graphql-response-cache}
     ✓ expected_result{mode:graphql-response-cache}
     ✓ no_errors{mode:graphql-no-parse-validate-cache}
     ✓ expected_result{mode:graphql-no-parse-validate-cache}
     ✓ no_errors{mode:uws}
     ✓ expected_result{mode:uws}

     checks.......................................: 100.00% ✓ 517098      ✗ 0     
     data_received................................: 2.1 GB  14 MB/s
     data_sent....................................: 104 MB  693 kB/s
     http_req_blocked.............................: avg=1.53µs   min=1.02µs   med=1.33µs   max=327.63µs p(90)=2.01µs   p(95)=2.19µs  
     http_req_connecting..........................: avg=2ns      min=0s       med=0s       max=138.44µs p(90)=0s       p(95)=0s      
     http_req_duration............................: avg=361.01µs min=218.01µs med=329.82µs max=18.63ms  p(90)=471.48µs p(95)=492.9µs 
       { expected_response:true }.................: avg=361.01µs min=218.01µs med=329.82µs max=18.63ms  p(90)=471.48µs p(95)=492.9µs 
     ✓ { mode:graphql-jit }.......................: avg=288.49µs min=218.01µs med=273.22µs max=18.63ms  p(90)=302.8µs  p(95)=314.06µs
     ✓ { mode:graphql-no-parse-validate-cache }...: avg=496.77µs min=411.12µs med=473.69µs max=6.46ms   p(90)=513.41µs p(95)=562.54µs
     ✓ { mode:graphql-response-cache }............: avg=347.55µs min=264.38µs med=330.97µs max=6.6ms    p(90)=360.61µs p(95)=371.08µs
     ✓ { mode:graphql }...........................: avg=363.63µs min=278.81µs med=337.55µs max=14.04ms  p(90)=381.61µs p(95)=424.57µs
     ✓ { mode:uws }...............................: avg=346.28µs min=265.83µs med=328.89µs max=5.97ms   p(90)=362.36µs p(95)=383.39µs
     http_req_failed..............................: 0.00%   ✓ 0           ✗ 258549
     http_req_receiving...........................: avg=32.98µs  min=16.43µs  med=32.65µs  max=3.19ms   p(90)=39.42µs  p(95)=41.93µs 
     http_req_sending.............................: avg=8.72µs   min=6.11µs   med=7.63µs   max=304.79µs p(90)=11.04µs  p(95)=12.16µs 
     http_req_tls_handshaking.....................: avg=0s       min=0s       med=0s       max=0s       p(90)=0s       p(95)=0s      
     http_req_waiting.............................: avg=319.3µs  min=187.62µs med=289.19µs max=18.54ms  p(90)=429.2µs  p(95)=449.12µs
     http_reqs....................................: 258549  1723.640999/s
     iteration_duration...........................: avg=575.15µs min=388.65µs med=539.67µs max=19.18ms  p(90)=689.04µs p(95)=714.49µs
     iterations...................................: 258549  1723.640999/s
     vus..........................................: 1       min=1         max=1   
     vus_max......................................: 2       min=2         max=2   

@enisdenjo enisdenjo merged commit bba7a83 into main Feb 14, 2025
28 checks passed
@enisdenjo enisdenjo deleted the res-cache-batching branch February 14, 2025 17:36
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.

Batching and caching seems to clash with each other
1 participant