Is it necessary to protect the API service from blocking the application by configuring it on its own Dispatcher too?
Usually not required. Check reference.conf , which comes as the default configuration with Spray, to make sure this dispatcher meets your needs. If not, specify a custom one.
Is it also common practice to use a router for an API service to handle large requests?
Typically, requests are forwarded to another Actor to unblock the route, or run as Future (possibly in a separate thread pool). See All Available Options Here: How is the .HttpService Atomization Request Performed? .
Finally, you should not block the route handler because it will block your service. From your description, it sounds like your lock code works in Future or similar. Until it forces the route handler to wait for the result / block it.
source share