I'm very new to Akka persistence, so please pardon me if this is a really 
simple question.

In this example (part of the documentation 
<http://doc.akka.io/docs/akka/snapshot/scala/persistence.html>). Example 
state is defined as following. 

case class ExampleState(*events: List[String]* = Nil) {
  def updated(evt: Evt): ExampleState = copy(evt.data :: events)

  def size: Int = events.length

  override def toString: String = events.reverse.toString
}


events is a List[String] of all the events till *now*. Now imagine if the 
state of this actor was updated *a million times* then events will be a 
List of million Strings (which may put memory pressure in case of a large 
string values) 

My understanding is that we *don't* need to keep all the events inside the 
current state of the PersistentActor. It is stored on the journal (and 
snapshot) and can be replayed by the PersistantActor or ViewActor to 
recreate the current state in case of a crash or to create a view. 

Again, I understand in this example, ALL events are stored in the current 
state. 
But I don't see using this pattern (of storing all the events data in the 
current state) to represent state for real use cases.  


Thanks
-Soumya


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