Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I scale my Scala REST application that uses Akka?
    primarykey
    data
    text
    <p>I have a Scala application using Akka that receives REST requests, makes some operations against a database, and responds with some information to the client. As it is, my db operations take a long time and my REST-enabled actor is unable to respond to new requests in the meantime, even though I could run lots of operations concurrently against the DB. I'm using the javax.ws.rs annotations to REST-enable methods in my actor.</p> <p>The question; what is the best way to enable my application to handle a large number of concurrent requests?</p> <p><strong>EDIT</strong>: I'll add some sample code.</p> <pre><code> import se.scalablesolutions.akka.actor._ import javax.ws.rs._ @Path("/test") class TestService { @GET def status() = actorPool !! Status(session). getOrElse(&lt;error&gt;Unable to connect to service&lt;/error&gt;) } class TestActor { def receive = { case Status() =&gt; { reply(SomeObject.slowDBMethod) } } } case class Status() </code></pre> <p><strong>EDIT2</strong>: This is what I'm getting in the log. I'm sending the three requests from my browser as fast as I can switch tabs and press F5, but the RS bean still waits for the first request to complete before handling the next.</p> <pre><code>[INFO] [2010-08-29 16:27:03,232] [akka:event-driven:dispatcher:global-15] c.n.StatusActor: got Slow request [INFO] [2010-08-29 16:27:06,916] [akka:event-driven:dispatcher:global-10] c.n.StatusActor: got Slow request [INFO] [2010-08-29 16:27:10,589] [akka:event-driven:dispatcher:global-3] c.n.StatusActor: got Slow request </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload