Thanks Patrik. My unit tests have shown that as long as I keep the mailbox capacity greater than then max number of events in a journal then recovery works fine. My actor's protocol is request / response based and relies on the client respecting that i.e. waiting for the response or a timeout. I am introducing the bounded mailbox as a guard against badly behaved clients who for some reason don't wait for a response or have an aggressive / short timeout with no backoff.
Thanks for the tip on setting the stash capacity as well - I will do that. Best regards, Seoras On Friday, December 1, 2017 at 4:12:42 PM UTC, Patrik Nordwall wrote: > > > > On Wed, Nov 29, 2017 at 11:14 AM, Seoras Ashby <[email protected] > <javascript:>> wrote: > >> Hi, >> >> Today my persistent actor is using the default >> UnboundedDequeBasedMailbox. However, to improve resiliency, I would like to >> use a non-blocking BoundedDequeBasedMailbox so that my persistent actor >> drops messages to dead letters if it is overwhelmed and cannot keep up with >> incoming messages. >> >> Config might be something like this: >> >> roqactor-mailbox { >> mailbox-type = "akka.dispatch.BoundedDequeBasedMailbox" >> mailbox-capacity = 500 >> mailbox-push-timeout-time = 0ms >> } >> >> I am concerned about any possible side effect the bounded mailbox might >> introduce on the recovery of the actor state from its persistent journal. >> >> Specifically does the mailbox-capacity need to be greater than the >> maximum number of journal events in the actor's journal? >> >> For example say my actor's persistent journal contains 4000 events and my >> mailbox-capacity is 500 will recovery work reliably? Or does my >> mailbox-capacity need to be at least 4000 in this example? >> > > That could be a problem, since such messages would just silently be > discarded and the state of the actor would be wrong after recovery. > > I think the main bottleneck is that incoming messages are stashed when the > actor is waiting for confirmation of persisting an event. The stash will > fill up, not the mailbox. Well, the mailbox is used for stashing, but you > get the point. Therefore we recommend setting the stash-capacity > https://doc.akka.io/docs/akka/current/persistence.html?language=scala#internal-stash > > You should also have some kind of flow control for incoming messages, e.g. > that the persistent actor sends acknowledgment back to the original sender > after persisting. Senders shouldn't have too many such requests in flight. > There are a lot of variations of implementing such flow control, including > using Akka Streams. > > Cheers, > Patrik > > >> >> Are other folks on this list using BoundedDequeBasedMailbox on their >> persistent actors? >> >> Are there any other side effects using a BoundedDequeBasedMailbox with a >> persistent actor that I should look into? >> >> Best wishes, >> Seoras >> >> -- >> >>>>>>>>>> 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] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> Visit this group at https://groups.google.com/group/akka-user. >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > > Patrik Nordwall > Akka Tech Lead > Lightbend <http://www.lightbend.com/> - Reactive apps on the JVM > Twitter: @patriknw > > -- >>>>>>>>>> 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 https://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.
