Skip to content

feat: parallelize requests by default #102

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

Merged
merged 1 commit into from
Jun 10, 2022
Merged

Conversation

aaron-steinfeld
Copy link
Contributor

Description

By default graphql-java does not create threads. The container may create separate threads for different requests, and some of our implementations create threads to parallelize within a data fetcher, but if multiple queries come in the same HTTP request (batch), each will be executed in serial on the same thread by default.

With this change, we use a configurable thread pool to hand off execution at the GQL query level, rather than the HTTP request level.

Testing

Tested E2E as well as adding UTs

Checklist:

  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Any dependent changes have been merged and published in downstream modules

@@ -17,6 +17,9 @@ data:
graphql.urlPath = {{ .Values.serviceConfig.urlPath }}
graphql.corsEnabled = {{ .Values.serviceConfig.corsEnabled }}
graphql.timeout = {{ .Values.serviceConfig.timeoutDuration }}

threads.io.max = {{ .Values.serviceConfig.threads.io }}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

No change here, just exposing existing pool for config with same default.

@github-actions

This comment has been minimized.

@codecov
Copy link

codecov bot commented Jun 9, 2022

Codecov Report

Merging #102 (f0fd795) into main (74f3d81) will increase coverage by 0.39%.
The diff coverage is 90.00%.

@@             Coverage Diff              @@
##               main     #102      +/-   ##
============================================
+ Coverage     57.98%   58.37%   +0.39%     
- Complexity      253      255       +2     
============================================
  Files            86       87       +1     
  Lines          1290     1307      +17     
  Branches         39       39              
============================================
+ Hits            748      763      +15     
- Misses          512      514       +2     
  Partials         30       30              
Flag Coverage Δ
unit 58.37% <90.00%> (+0.39%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
.../core/graphql/context/AsyncDataFetcherFactory.java 88.23% <88.23%> (ø)
...l/context/DefaultGraphQlRequestContextBuilder.java 83.72% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 74f3d81...f0fd795. Read the comment docs.

@aaron-steinfeld
Copy link
Contributor Author

Snyk resolved in #103

@aaron-steinfeld aaron-steinfeld merged commit 5b612df into main Jun 10, 2022
@aaron-steinfeld aaron-steinfeld deleted the parallelize-requests branch June 10, 2022 13:58
@github-actions
Copy link

Unit Test Results

32 files  +1  32 suites  +1   33s ⏱️ +5s
98 tests +1  98 ✔️ +1  0 💤 ±0  0 ❌ ±0 

Results for commit 5b612df. ± Comparison against base commit 74f3d81.

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.

2 participants