Hello Curtis!
Replies in-line :-)

1. What is the problem persistence is meant to solve? Is it just to be able
> to recover actors after an error or crash or are there uses beyond that?
> The Scala Days 2014 talk hinted at some kind of link between persistence
> and queries that I didn't quite get.
>
We're referring to what CQRS
<http://cqrs.files.wordpress.com/2010/11/cqrs_documents.pdf> (and Domain
Driven Design) people call a "read model".

Think of it as:
* PersistentActor stores a sequence of events.
* Based on this series of events you can build different projections of the
data, geared up specifically for reads (the persistent actor is the "write
model", views are the "read model").
* You can spin up PersistentViews using the same persistenceId. They will
get the same events played back as the PA. A view can be a
view-specific-model (here I mean view as in a webapps view / form).
  Such view can be prepared to reply to questions a view may ask ASAP,
because during playback it prepares the answers ahead of time, instead "oh,
so now I will calculate the avg()" like you would with querying a RDBMS.

In essence - you spin up the View when you know you'll need that data, then
when the question arrives, you have it computed already and it can be kept
up to date easily because it (the View) will get new events persisted by
the PersistentActor too.


> 2. Can or should persistence be used to replace at least part of a
> traditional database store?
>
Indeed, it is aimed to replace ORM / RDBMS with event sourcing.
And persistence is a great tool for event sourcing :-)
Underneeth there will be a database of course, but most often something
like Cassandra or HBase - which are great at taking huge numbers of writes,
and scanning (for our replay mechanisms).


> 3. What algorithm do people use to decide when (or if) to store snapshots?
> I imagine a journal could get very large in a busy system.
>
It will usually fall into one of these I guess:
* by time - "daily snapshot" etc
* as optimisation - "we should snapshot every 10000 events because playback
takes too long for our case otherwise"
* by some business thing - taking a snapshot after some successful long
running job perhaps, etc.

I'd love to hear more examples of how our users determine when to snapshot
too actually - we're constantly looking for feedback! :-)


I hope this helps, happy hakking!

-- 
Cheers,
Konrad 'ktoso' Malawski
hAkker @ Typesafe

<http://typesafe.com>

-- 
>>>>>>>>>>      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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
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