Hi Alex,
I'll answer in-line:

The idea is to have an application that I can clone depending on the load.

Yeap, exactly.


> With akka persistence (event sourcing), if I clone an app I will have N
> persistents actor with the same persistent id :
>
No, because actor creation should not be hard-coded, but be an effect of
some interaction.
If client A messages come in (via cluster sharding
<http://doc.akka.io/docs/akka/2.3.4/contrib/cluster-sharding.html>) to
server X, you'd start the "actor to handle A" on node X.
This is done via cluster sharding, I recommend you to have a look at it :-)

The next to points in your email are a bit confusing.
Journal == Distributed Journal == "some kind of DB" accessible for all
nodes.

What is the best way to deal with this problem ?

Basically you really want to have a distributed journal. By distributed
journal we mean "the same journal available from all nodes", as in
Cassandra cluster etc.
Then, you must guarantee that only one guy is writing to the journal under
a given persistenceId, or you'd get two points of view mixed together.
You can achieve this via cluster sharding rather easily.

For exemple if I have a shopping cart and the events are the actions the
> users can perform (create cart, add item, order ...) how can I scale that
> with akka persistence and event sourcing ?

Cluster sharding and passivating users which have not done anything since
some amount of time.
Then the guy comes back, sharding kicks in, starts the actor on "some
shard", then it replays its state (because PersistentActor), then it gets
the message "as if it never was gone".


Ok I understood that each persistent actor have for name the id used for
> the shard so there will as many persistent actor as users/shopping cart in
> my exemple (if I use the persistent id used in the activator ie
> self.path.parent.name + "-" + self.path.name) .
> We can't have one persistent actor handling all the users for a node.
>
> I did some test with two nodes : A and B. I start my tests and the events
> goes to node A and are written to the journal. I stop A and the I can see
> the command arriving to B but no event are created on the journal. Is there
> something to take care to make this working ?
>
By you see the message arriving you mean there's a new actor started and it
receives the message? Does it call persist?
Are you sure you're looking at the right journal to verify it creates this
event?


HTH

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