drepster
07/15/2025, 5:54 PMdrepster
07/15/2025, 6:07 PMJarkko-Metaplay
07/16/2025, 8:36 AMNodeSetPlacement => NodeSetPlacement.Logic to NodeSetPlacement.Service to run it on the dedicated service node when running in multi-node setup.
> I'm wondering whether I should use ServicesProxies as EntityShardGroup.
EntityShardGroup only controls the order in which the Services/Entities are started up on server boot. Normally this doesn't need to be tweaked.
The exception is mainly in the case of "Proxy" entities which copy the main entity's state into a node-local global variable.
Since we want the global variable set before some depending entities start, we have the Proxy entity on ServicesProxies and dependees on Workloads.Jarkko-Metaplay
07/16/2025, 8:37 AMTask.Run().
However, as you say, there is always messaging, processing and sometimes network latency in the read access if implemented over MetaMessages / EntityAsk.
It really depends on use case if this adds up or not but in some cases we indeed avoid the latency with a primary/replica pattern which we call Manager/Proxy.
If you want to implement this, check out LiveOpsTimelineProxyActor. The implementations is roughly as:
* LiveOpsTimelineManager is a persisted entity that maintains state. State can be mutated by LiveOps dashboard. Manager is a singleton.
* A single ProxyActor lives on every node.
* ProxyActor subscribes to the manager on start and updates a ActiveLiveOpsEventState global variable.
* When manager state is changed, manager informs Proxies, and Proxies update the global variable.
* All consumers can read the current data from LiveOpsTimelineProxyActor.ActiveLiveOpsEventState.
* (To read the data, you need the AtomicValueSubscriber and remember to call Update() before accessing Current)
> Should implement some simple caching in the entities that need the data?
That is possible approach too. However, if the caching is needed, I would personally prefer the Proxy pattern so the cached is updated almost immediately instead of waiting for the stale data to invalidate.Jarkko-Metaplay
07/16/2025, 8:37 AMdrepster
07/17/2025, 10:08 AM