You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe. AbstractGraphQLHttpServlet implements async request execution by deferring execution to user provided ExecutorService. This still means that a new thread is held per request being executed. Complete async support would allow to avoid holding any threads while service is waiting for any downstream IO to complete increasing GraphQL server scalability.
Describe the solution you'd like GraphQLInvoker already supports async execution by returning CompletableFuture.
To solve this several classes need to be converted to run execution asynchronously and call Jetty asyncContext.complete() after last of CompletableFuture is complete.
These include:
HttpRequestHandlerImpl invoke() and execute() methods to become async and return CompletableFuture. handle() method either to become async, or accept Jetty AsyncContext to call asyncContext.complete() upon execute() completion.
Describe alternatives you've considered
Alternative is to not use Async execution at all, to reduce overhead of transferring "work" from Jetty thread pool to asyncExecutor thread pool and increasing Jetty thread pool size instead. Number of parallel requests that can be processed is limited by the size of Jetty thread pool. In async mode number of parallel requests is limited by the size of GraphQLConfiguration.asyncExecutor. That's practically the same as limiting at Jetty level, except additional "work" is required to move request execution from Jetty thread pool to GraphQLConfiguration one.
Additional context
N/A
The text was updated successfully, but these errors were encountered:
+1, I'm in a situation where I'm fetching data from an async backend, so that would be really useful.
In async mode number of parallel requests is limited by the size of GraphQLConfiguration.asyncExecutor. That's practically the same as limiting at Jetty level, except additional "work" is required to move request execution from Jetty thread pool to GraphQLConfiguration one.
Completely agree with that.
olim7t
added a commit
to olim7t/graphql-java-servlet
that referenced
this issue
Sep 17, 2020
Is your feature request related to a problem? Please describe.
AbstractGraphQLHttpServlet implements async request execution by deferring execution to user provided ExecutorService. This still means that a new thread is held per request being executed. Complete async support would allow to avoid holding any threads while service is waiting for any downstream IO to complete increasing GraphQL server scalability.
Describe the solution you'd like
GraphQLInvoker already supports async execution by returning CompletableFuture.
To solve this several classes need to be converted to run execution asynchronously and call Jetty asyncContext.complete() after last of CompletableFuture is complete.
These include:
Describe alternatives you've considered
Alternative is to not use Async execution at all, to reduce overhead of transferring "work" from Jetty thread pool to asyncExecutor thread pool and increasing Jetty thread pool size instead. Number of parallel requests that can be processed is limited by the size of Jetty thread pool. In async mode number of parallel requests is limited by the size of GraphQLConfiguration.asyncExecutor. That's practically the same as limiting at Jetty level, except additional "work" is required to move request execution from Jetty thread pool to GraphQLConfiguration one.
Additional context
N/A
The text was updated successfully, but these errors were encountered: