I have an application that sends multiple request to my spray-can 1.3.1
server.
FireBug shows me, that these requests are triggered in parallel.
However, on the server these request are handled strictly serially.
I think I need to somehow configure the spray server to handle multiple requests in parallel - but how?
The server is started like that:
object Server extends SimpleRoutingApp{
def main(args: Array[String]): Unit = {
implicit val system = ActorSystem()
startServer("0.0.0.0", port = 8080) {
get{
pathSingleSlash {
complete{
HttpEntity(
MediaTypes.`text/html`,
Template.txt
)
....
As Spray routing is synchronous in an actor, you will need to do something else to make it handle multiple requests in parallel.
Detach
directive: This directive will spawn a new actor to process that request.