Hi Moiz,

20 jul 2014 kl. 00:28 skrev Moiz Raja <[email protected]>:

> Ronald and Konrad. Firstly thanks for your responses.

(I’m Roland, BTW ;-) )

> So, as it so happens I do want my actor to be persistent in the sense that I 
> do want to be able to shutdown my actor, restart it and have it back to the 
> state it was in before it was shutdown. akka-persistence is a great fit for 
> that. Now I want the state of this actor to also be replicated for HA 
> purposes so that when my actor cannot start up or I cannot connect to it I 
> should be able to connect to a replica and keep going. This is where raft 
> comes in.

Why should RAFT come in here? What you describe is exactly the purpose of Akka 
Persistence, the idea is to use a replicated journal that ensures that the 
actor can be resurrected anywhere in the cluster in case of a node failure. The 
journal implementation might use RAFT (or whichever consensus protocol it 
chooses) under the covers, but that should be transparent to the actor itself.

Thinking about your problem description there is one potential issue that I can 
see: a replicated log for Akka Persistence is supposed to be consistent. If 
this characteristic does not fit your requirements (i.e. you actually need to 
tolerate inconsistency in order to achieve the availability you need) then you 
would indeed need to step outside the normal bounds of Persistence; I would 
recommend thinking in terms of the Journal SPI layer first, though, and 
investigate whether there are replicated log implementations that give you what 
you want. The only extension you need is that the log can tell you when to 
spawn that actor on which system (based on availability estimators—we are 
talking machines taking guesses here).

But the previous paragraph clearly is for rather specialized use-cases only, a 
normal replicated journal should be the answer in almost all cases—that means 
until proven otherwise for your case.

Regards,

Roland

> The only thing frankly which was stopping me from using akka-persistence was 
> the fact that I could not read entries in the log directly. I have a 
> workaround for that and I think it may work for me. Basically here is how it 
> works - besides persisting the log onto disk with akka-persistence I also 
> maintain the log in-memory. The in-memory log is trimmed when I create a 
> snapshot. Since akka-persistence creates a snapshot of the whole journal and 
> not upto a specific journal entry my snapshot consists both of the state of 
> the actor and all the "unapplied entries" from the log. The in-memory log 
> after a snapshot is created is therefore only the entries which were not 
> applied to the state. 
> 
> This workaround of mine will use more memory certainly but overall I think it 
> may not be bad as it does make reading log entries faster.
> 
> Let me know if you have concerns about my approach.
> 
> Thanks,
> -Moiz
> 
> -- 
> >>>>>>>>>> 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.



Dr. Roland Kuhn
Akka Tech Lead
Typesafe – Reactive apps on the JVM.
twitter: @rolandkuhn


-- 
>>>>>>>>>>      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.

Reply via email to