-
Notifications
You must be signed in to change notification settings - Fork 565
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
Batching RFC support #1662
Batching RFC support #1662
Conversation
🦋 Changeset detectedLatest commit: b26382f The changes in this PR will be included in the next version bump. This PR includes changesets to release 15 packages
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 |
The latest changes of this PR are not available as canary, since there are no linked |
✅ Benchmark Results
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- This should have an
EXPERIMENTAL_
feature flag to enable this in forcreateServer
- As we discussed a little on Slack, we should give some options for user to configure the limit of batched ops that can be sent
Also an interesting but maybe out of scope thing would be to also support streaming the individual results to the client, as they are finished 🤔 |
I agree this would be really interesting (defer/stream approach can be used) |
0a7b9f3
to
0b8f4bb
Compare
I added a new |
packages/graphql-yoga/src/server.ts
Outdated
/** | ||
* You can limit the number of batched operations per request. | ||
* | ||
* Set this to undefined or 0 to disable batching. | ||
* | ||
* @default 0 | ||
*/ | ||
batchingLimit?: number |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
batching should be opt-in
in my opinion, we can take inspiration from the error masking configuration:
batching: boolean | { limit?: number }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is already opt-in. See https://github.com/dotansimha/graphql-yoga/pull/1662/files#diff-40184c12fde3ff11137997025804dc55fa5a6455d9feb557320a4ab37c0c1d10R113
I didn't want to allow true
because true
would mean Infinity
but instead here this encourages users to give an exact number for the limit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One argument from my side on why we should use batching: boolean | { limit?: number }
instead of just a batchingLimit
is that we could potentially group future batching
options under the batching
key without introducing a breaking change release.
Right now I have no examples for additional options, but past experience showed that this might happen eventually. As for batching: true, the default config could be something like
{ limit: 10 }`.
febf51e
to
047a2a4
Compare
🚀 Snapshot Release (
|
Package | Version | Info |
---|---|---|
@graphql-yoga/apollo-link |
1.0.0-alpha-20220906111732-dd8d69f3 |
npm ↗︎ unpkg ↗︎ |
@graphql-yoga/urql-exchange |
1.0.0-alpha-20220906111732-dd8d69f3 |
npm ↗︎ unpkg ↗︎ |
@graphql-yoga/common |
3.0.0-alpha-20220906111732-dd8d69f3 |
npm ↗︎ unpkg ↗︎ |
@graphql-yoga/graphiql |
2.4.3-alpha-20220906111732-dd8d69f3 |
npm ↗︎ unpkg ↗︎ |
graphql-yoga |
3.0.0-alpha-20220906111732-dd8d69f3 |
npm ↗︎ unpkg ↗︎ |
@graphql-yoga/node |
3.0.0-alpha-20220906111732-dd8d69f3 |
npm ↗︎ unpkg ↗︎ |
@graphql-yoga/plugin-apollo-inline-trace |
1.0.0-alpha-20220906111732-dd8d69f3 |
npm ↗︎ unpkg ↗︎ |
@graphql-yoga/plugin-apq |
1.0.0-alpha-20220906111732-dd8d69f3 |
npm ↗︎ unpkg ↗︎ |
@graphql-yoga/plugin-persisted-operations |
1.0.0-alpha-20220906111732-dd8d69f3 |
npm ↗︎ unpkg ↗︎ |
@graphql-yoga/plugin-response-cache |
1.0.0-alpha-20220906111732-dd8d69f3 |
npm ↗︎ unpkg ↗︎ |
@graphql-yoga/render-graphiql |
3.0.0-alpha-20220906111732-dd8d69f3 |
npm ↗︎ unpkg ↗︎ |
047a2a4
to
f7eedb0
Compare
/theguild newsletter |
Closes #1661