Note that there are some explanatory texts on larger screens.

plurals
  1. POAkka Actors: Handling DB Failures Without Losing Data
    primarykey
    data
    text
    <p><strong>Scenario</strong><br /> The DB for an application has gone down. This results in any actor responsible for committing important data to the DB failing to get a connection</p> <p><strong>Preferred Behaviour</strong><br /> The important data is written to the db when it comes back up <em>sometime in the future</em>.</p> <p><strong>Current Implementation</strong><br /> The actor catches the DBException, wraps the data in a DBWriteFailed case class, and sends the message to its supervisor. The supervisor then schedules another write for sometime in the future (e.g. 1 minute) using system.scheduler.scheduleOnce(...) so that we don't spin in circles too much while waiting for the DB to come back up.</p> <p>This implementation certainly works but I feel there might be a better way.</p> <ul> <li>The protocol gets a bit messier when the committing actor has to respond to the original sender after a successful commit.</li> <li>The regular flow of messages to the committing actor is not throttled in any way and the actor will happily process the new messages, likely failing to connect to the DB for each and every one of them.</li> <li>If messages get caught in this retry loop for too long, the mailboxes of the committing actors will start to balloon. It is important that this data be committed, but none of it matters if the application crawls to a halt or crashes due to excessive memory usage.</li> </ul> <p>I am an akka novice and I am largely inexperienced when it comes to supervisor strategies, but I feel as though I may be able to leverage one of those to handle some of this retry logic.</p> <p>Is there a common approach in akka for solving a problem like this? Am I on the right track or should I be heading in a different direction?</p> <p>Any help is appreciated.</p>
    singulars
    1. This table or related slice is empty.
    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.
    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