Recovery of persistent actors

Dear experts,

I am doing some investigations on the integration of Akka into our trading system. Basically we would like to create the actor with persistence and snapshot per Order.

My questions:

  • With 200 millions Order per day, would that be a good practice to create so many actors in the cluster? The command on the Order would need to cross the JVM instance
  • How to recover most of the actors on cluster restart? Since we create the actor per order id, do we need to ask the supervisor to persist the actors on the fly.

Appreciated for your advice.
Kind Regards,

That is 2314 orders/second if you use all 24 hours of the day. That is a substantial load but maybe not impossible if you spread it over a cluster of nodes.

Cluster Sharding is the goto solution for this.

I guess that all 200 million orders are not active at the same time so with passivation that should also be possible, with a cluster of nodes. How many you need and how to scale the persistence backend is very application specific so you need to try and measure.

Cluster Sharding starts the actor when the first message arrives and then the actor stays in memory until passivated or other reasons for shutdown.

Rehydrating the active actors on cluster restart can be difficult. Cluster Sharding has a feature called “remember entities” but that will currently not scale to this level and also adds rather big overhead when starting and stopping the actors. Easiest would be if you don’t need this part, but rely on the on-demand startup when messages are sent to the actors.

1 Like

thanks to @patriknw

Regarding the rehydrating active actors, I would prefer to start the actors on demand.