So I eliminated the remaining ask in this area of my application (i.e removed the Future-returning "storage client" abstraction.) Each child recovers its persistent state with a tell to the DbActor, switching states with become until it gets the response.
I didn't do any further investigation of the timeouts I was getting before, but without the ask I am now loading about 6000 children this way. As a bonus, my REST api to gather info is performing decently now, producing the JSON response for the 6000 actors in about 800ms. Recovering all 6000 actors via Slick still seems a lot slower than Akka Persistence, but in fairness I'm not looking them up by primary key. Anyway, another endorsement for stamping out ask. On Thu, Oct 16, 2014 at 10:39 PM, Richard Rodseth <[email protected]> wrote: > I have an actor with many children (about 900 in my current test). > In the course of initializing them, the parent reads some state for each > child from the database, one at a time. I'd love to make these children > PersistentActors, but haven't yet. > I have my DbActor (just one for now) using Slick, assigned to its own > dispatcher. > The DbActor actually lives behind an object implementing a "storage > client" interface which returns Futures and does an ask of the DbActor. I > was able able to eliminate asks in the web tier using the per-request actor > pattern. > > I'm seeing timeouts logged by the following code: > > val processingStateFuture:Future[Option[ProcessingState]] = > storageClient.findProcessingState(id) > val msgFuture: Future[Child.Prepare] = processingStateFuture.map { ps > => Child.Prepare(ps) } > > // Be careful not to close over mutable state.eg, "sender" is mutable > msgFuture.onComplete { > case Success(msg) => child ! msg > case Failure(e) => log.error(s"Failure preparing child $e") > } > > Most of the time I use pipeTo, but not in this case. > > Wondering if I should make the DbActor a router, or forgo the "storage > client" abstraction and use a tell with the response going to the child. Or > something else entirely. > > As an aside, I am able to send a "gather info" message to all 900 children > and produce an HTTP response in a couple of hundred ms. But at 13000 > children, that times out at 20s. > > Thoughts? > > -- >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>> Check the FAQ: >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user --- You received this message because you are subscribed to the Google Groups "Akka User List" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.
