-
Notifications
You must be signed in to change notification settings - Fork 5
How to provide Entity activation/passivation #6
Comments
activation and passivation are all about the economics of the proxy regarding resources allocated or not, right? This topic might lead to an even broader one. If the proxy balances load or lets the user follow an entity by frontend client or just pre-warms entities on cluster nodes, entity activation and passivation seems to be the tool to do that. Since we have no Akka-cluster functionality available (and I don't know which part of Akka-cluster is doing that), the response to this issue leads us to how and a which level we get this implemented. I think this too brings us to (persistent) state management? |
yes i think that all these questions you raised are valid and we should reflect on what level we want to reach. |
But perhaps it is only about persistence the theme activation and passivation |
I agree, I'm too would expect the proxy would be able to route messages to any node. I think entity activation and passivation will be part of both topics of state management and message routing and then also remoting (with which whatever that might be). |
I agree. |
I think there is nothing in the cs-spec that defines activation and passivation but defines certain messages to re-establish state on a user functions entity. So far, the reference cs-proxy does close the stream to passivate an entity. It might use a As the user entities cannot emit events and changes without an incoming command, cloudstate can "pre-warm" entities and therefore activate entities whenever the proxy likes to do it. |
The fact appears to be a warm-up step contemplated in the proxy of the reference implementation, where a special EventSourcedStream Init message is sent and handled by the proxy, but it does not appear to be heating up the user's functions, but rather the proxy itself. |
I agree, pre-warming was an invention by my imagination; I'd consider doing that if an entity, if crashed, would benefit from something like that. |
I believe that if you were able to preemptively activate an entity function, perhaps sending an Init message to a particular entity key in order to make the user function benefit in some way, it would be interesting to support it. |
I agree. I don't know Akka cluster, but I'd imagine activation, and that is (pre-)initialize an entity, or even a stream even without state, could help in certain scenarios. So this is all what activation would be:
|
I think it's valid but I don't know if we would be able to generate a stream without an init message, I think not following the CloudState protocol like the one that currently exists. |
Hello guys, I took a moment to think about the BEAM Processes structure needed to build support for EventSourced and CRDT entity types. I know that the scala proxy uses Akka Cluster Sharding to spread each Entity identified with a persistenceId by the Akka cluster, so I reread the Akka Cluster Sharding documentation to try to understand how we could reproduce this behavior in our Proxy.
It also says the following about persistent actors (in this case these are used in the Cloudstate reference implementation):
Now that we know how Akka Cluster Sharding works, let's take a look at Horde. With these Horde resources I think we can use the following sequence: In this diagram I tried to explain the responsibilities of each process, for example Dispatcher is the mechanism that communicates with the gRPC server while the Entity speaks only with the user role. ping @marcellanz @ralphlaude |
@sleipnir makes all sense. Lets discuss shortly on discord and then update here. |
I understand the issue and it makes sense to me @sleipnir. I don't really understand the last sentence. In case of a migration from one to another we have to access the database on restart. It is not the best approach but it is the robust on. I don't really see how we can prevent access to the database during migration. |
Not really @ralphlaude , we don't access the physical storage database, we access the state of the previous Actor that was migrated from node to the new process, all of this through the passing of messages between actors, we access the real physical base if there is no state (state is empty) and just to make sure that the data is consistent This is done through a process called StateHandoff that uses Horde to ensure that the process is only completed after the state has been migrated to a new process |
What is the best way to implement passivation and activation of entities?
The text was updated successfully, but these errors were encountered: