KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
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. The question; what is the best way to enable my application to handle a large number of concurrent requests? EDIT : I'll add some sample code. import se.scalablesolutions.akka.actor._ import javax.ws.rs._ @Path("/test") class TestService { @GET def status() = actorPool !! Status(session). getOrElse(<error>Unable to connect to service</error>) } class TestActor { def receive = { case Status() => { reply(SomeObject.slowDBMethod) } } } case class Status() EDIT2 : 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. [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
Tags (comma-separated)
Save Edits
Cancel