Run async task in thread pool separated from HTTP worker pool
oliemansm opened this issue · 0 comments
Is your feature request related to a problem? Please describe.
The default AsyncContext.start(Runnable)
is used to run the GraphQL request in a separate Thread when enabled. The default implementation by the servlet containers (e.g. Tomcat, Jetty) is to use a Thread of the HTTP worker thread pool. Defeating the purpose of running it in a separate Thread in the first place, since it's then still blocking a HTTP worker thread. See this article for a thorough explanation of this issue, which also discusses the concern whether there's a benefit of using this feature at all.
Describe the solution you'd like
People of this library might still want to be able to use this functionality, but as described in the original feature request the main idea is that it would spawn in a different Thread pool and it would stop blocking HTTP worker Threads. It should be possible to provide your own executor pool that should be used instead.
Example implementation: https://developerlife.com/2011/04/13/creating-asynchronous-servlets-with-tomcat-7-servlet-3-0-api/.