Closed rajadain closed 6 years ago
See related comment in original issue: https://github.com/WikiWatershed/mmw-geoprocessing/issues/47#issuecomment-316501936
Even with blocking operations within the scope of a single request/response cycle, we should be able to handle multiple requests in parallel due to the thread pool managed by Akka HTTP to handle connections. You're saying that things block at 2 requests, or when the Akka HTTP thread pool is saturated?
From a comment on #47 (here https://github.com/WikiWatershed/mmw-geoprocessing/issues/47#issuecomment-325742599):
My suggestion for further optimization is to use Futures for fetching layers in parallel. This would mean changing this method to return a Future[Seq[TileLayerCollection[SpatialKey]]], and spidering the Futures through the codebase. akka-http lets you return a Future from the route, so you could carry the future all the way through to the route.
The comment has more detail, but as part of this issue we should update each of the codepaths to interlace Future
s throughout.
You're saying that things block at 2 requests, or when the Akka HTTP thread pool is saturated?
It felt like it was blocking at 2 requests when given a very large input, but that may be because of CPU overutilization than thread pool saturation.
Currently, the model calls seem to be blocking, so when faced with a large long-running requests, shorter requests have to wait for them to finish.
Investigate returning a
Future
instead, so the requests can be made lock-free.