Skip to content

feat: parallelize requests by default#102

Merged
aaron-steinfeld merged 1 commit intomainfrom
parallelize-requests
Jun 10, 2022
Merged

feat: parallelize requests by default#102
aaron-steinfeld merged 1 commit intomainfrom
parallelize-requests

Conversation

@aaron-steinfeld
Copy link
Copy Markdown
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

graphql.corsEnabled = {{ .Values.serviceConfig.corsEnabled }}
graphql.timeout = {{ .Values.serviceConfig.timeoutDuration }}

threads.io.max = {{ .Values.serviceConfig.threads.io }}
Copy link
Copy Markdown
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
Copy Markdown

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
Copy Markdown
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
Copy Markdown

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