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

GraphQL SSE Single Connection mode #2458

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ardatan
Copy link
Collaborator

@ardatan ardatan commented Feb 17, 2023

  • Return parse and validation errors as-is
  • Lazy mode

@changeset-bot
Copy link

changeset-bot bot commented Feb 17, 2023

⚠️ No Changeset found

Latest commit: 4a4289c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@ardatan ardatan changed the base branch from main to graphql-sse-compat February 17, 2023 12:32
@ardatan ardatan changed the title Graphql sse single connection WIP: GraphQL SSE Single Connection mode Feb 17, 2023
@ardatan ardatan force-pushed the graphql-sse-single-connection branch from 3111e25 to 3bc7205 Compare February 17, 2023 12:35
@github-actions
Copy link
Contributor

github-actions bot commented Feb 17, 2023

🚀 Snapshot Release (rc)

The latest changes of this PR are available as rc on npm (based on the declared changesets):

Package Version Info
@graphql-yoga/apollo-link 1.7.0-rc-20230321152011-4a4289cc npm ↗︎ unpkg ↗︎
@graphql-yoga/urql-exchange 1.7.0-rc-20230321152011-4a4289cc npm ↗︎ unpkg ↗︎
@graphql-yoga/common 3.8.0-rc-20230321152011-4a4289cc npm ↗︎ unpkg ↗︎
graphql-yoga 3.8.0-rc-20230321152011-4a4289cc npm ↗︎ unpkg ↗︎
@graphql-yoga/node 3.8.0-rc-20230321152011-4a4289cc npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-apollo-inline-trace 1.8.0-rc-20230321152011-4a4289cc npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-apq 1.8.0-rc-20230321152011-4a4289cc npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-csrf-prevention 1.4.0-rc-20230321152011-4a4289cc npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-defer-stream 1.8.0-rc-20230321152011-4a4289cc npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-disable-introspection 0.7.0-rc-20230321152011-4a4289cc npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-graphql-sse 1.4.0-rc-20230321152011-4a4289cc npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-persisted-operations 1.8.0-rc-20230321152011-4a4289cc npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-prometheus 1.8.0-rc-20230321152011-4a4289cc npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-response-cache 1.8.0-rc-20230321152011-4a4289cc npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-sofa 1.8.0-rc-20230321152011-4a4289cc npm ↗︎ unpkg ↗︎
@graphql-yoga/render-graphiql 3.8.0-rc-20230321152011-4a4289cc npm ↗︎ unpkg ↗︎

@github-actions
Copy link
Contributor

github-actions bot commented Feb 17, 2023

❌ Benchmark Failed

Performance regression detected: it seems like your Pull Request adds some extra latency to GraphQL Yoga

If the performance regression is expected, please increase the failing threshold.

     ✓ 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}

     checks.......................................: 100.00% ✓ 204714     ✗ 0     
     data_received................................: 843 MB  7.0 MB/s
     data_sent....................................: 41 MB   345 kB/s
     http_req_blocked.............................: avg=2.82µs   min=1.5µs    med=2.29µs   max=1ms      p(90)=3µs      p(95)=3.4µs   
     http_req_connecting..........................: avg=12ns     min=0s       med=0s       max=776.61µs p(90)=0s       p(95)=0s      
     http_req_duration............................: avg=807.42µs min=385.9µs  med=662.41µs max=31.52ms  p(90)=1.12ms   p(95)=1.23ms  
       { expected_response:true }.................: avg=807.42µs min=385.9µs  med=662.41µs max=31.52ms  p(90)=1.12ms   p(95)=1.23ms  
     ✓ { mode:graphql-jit }.......................: avg=644.93µs min=385.9µs  med=565.6µs  max=22.5ms   p(90)=710.99µs p(95)=843.32µs
     ✗ { mode:graphql-no-parse-validate-cache }...: avg=1.19ms   min=851.01µs med=1.09ms   max=24.79ms  p(90)=1.29ms   p(95)=1.56ms  
     ✓ { mode:graphql-response-cache }............: avg=691.72µs min=428µs    med=613.61µs max=21.86ms  p(90)=754.32µs p(95)=846.28µs
     ✓ { mode:graphql }...........................: avg=833.95µs min=504µs    med=722.11µs max=31.52ms  p(90)=911.41µs p(95)=1.11ms  
     http_req_failed..............................: 0.00%   ✓ 0          ✗ 102357
     http_req_receiving...........................: avg=46.77µs  min=22.4µs   med=40µs     max=12.12ms  p(90)=57.9µs   p(95)=73µs    
     http_req_sending.............................: avg=21.75µs  min=8.69µs   med=12.7µs   max=3.82ms   p(90)=23.1µs   p(95)=32.5µs  
     http_req_tls_handshaking.....................: avg=0s       min=0s       med=0s       max=0s       p(90)=0s       p(95)=0s      
     http_req_waiting.............................: avg=738.9µs  min=349.2µs  med=601.01µs max=31.43ms  p(90)=1.05ms   p(95)=1.15ms  
     http_reqs....................................: 102357  852.957909/s
     iteration_duration...........................: avg=1.16ms   min=636.01µs med=1.01ms   max=32.41ms  p(90)=1.48ms   p(95)=1.64ms  
     iterations...................................: 102357  852.957909/s
     vus..........................................: 1       min=1        max=1   
     vus_max......................................: 2       min=2        max=2   

Copy link
Collaborator

@enisdenjo enisdenjo left a comment

Choose a reason for hiding this comment

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

This looks good. We'll have to also make sure:

  • there's ever only one active SSE per token
  • if the SSE connects late, we should flush the subscription messages that emitted before
  • this supports just the single connection mode (and therefore both modes with GraphQL SSE Distinct Connections support #2445), should we rename the package? or maybe ship it with the core?

packages/plugins/graphql-sse/src/index.ts Outdated Show resolved Hide resolved
@ardatan ardatan force-pushed the graphql-sse-single-connection branch 2 times, most recently from 02d64f0 to 923b20d Compare March 20, 2023 15:47
@github-actions
Copy link
Contributor

github-actions bot commented Mar 20, 2023

Apollo Federation Subgraph Compatibility Results

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

Learn more:

Base automatically changed from graphql-sse-compat to main March 21, 2023 14:50
@ardatan ardatan force-pushed the graphql-sse-single-connection branch from ff0053c to c0e3ee5 Compare March 21, 2023 15:02
@ardatan ardatan changed the title WIP: GraphQL SSE Single Connection mode GraphQL SSE Single Connection mode Mar 21, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Mar 21, 2023

💻 Website Preview

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

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

2 participants