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

feat(batching): avoid calculating document ast height in advance #1800

Conversation

samuelAndalon
Copy link
Contributor

📝 Description

Batching by LEVEL requires to calculate the height of all graphql documents in a batch request to be calculated before deciding of a certain level was dispatched, the reason is because a batch request could contain multiple and potentially different operations, with different levels, so, to decide if a level was dispatched, we need to know which operations in the batch request share the same level.

This PR will remove that logic, which was take it from the graphql-java MaxDepthInstrumentation.

Instead we will calculate the height on runtime, simplifying the dispatch by level instrumentation and removing some CPU usage by not doing an AST traversal to calculate height.

@samuelAndalon samuelAndalon changed the title feat: avoid calculating document ast height in advance feat(batching): avoid calculating document ast height in advance Jun 16, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@samuelAndalon samuelAndalon merged commit 2520867 into ExpediaGroup:master Jun 19, 2023
samuelAndalon added a commit to samuelAndalon/graphql-kotlin that referenced this pull request Jun 19, 2023
…ediaGroup#1800)

Batching by LEVEL requires to calculate the height of all graphql
documents in a batch request to be calculated before deciding of a
certain level was dispatched, the reason is because a batch request
could contain multiple and potentially different operations, with
different levels, so, to decide if a level was dispatched, we need to
know which operations in the batch request share the same level.

This PR will remove that logic, which was take it from the graphql-java
[MaxDepthInstrumentation](https://github.com/graphql-java/graphql-java/blob/master/src/main/java/graphql/analysis/MaxQueryDepthInstrumentation.java#L56).

Instead we will calculate the height on runtime, simplifying the
dispatch by level instrumentation and removing some CPU usage by not
doing an AST traversal to calculate height.
samuelAndalon added a commit that referenced this pull request Jun 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants