Closed burakakca closed 1 year ago
The "simple" example doesn't work with multiple pods. Redis is indeed used not only for storing assignments, but also to propagate assignment changes to other pods. When using in-memory storage, the changes are not propagated.
When I add an entity record from one or both pods ; Pod1 and Pod2
_ <- guild.send("guild1")(Join(user1, _)).debug
_ <- guild.send("guild1")(Join(user2, _)).debug
_ <- guild.send("guild1")(Join(user3, _)).debug
Is this record added to the Redis and same-time cache or not?
Or let's say I have a Get function and this function returns a user, in this point, Is user returns from the cache or Redis.
Also can you help me that complex example section error above?
Complex redis examples
In the simple example, both the entity data and the shard assignments are stored in memory. In the complex example, both the entity data and the shard assignments are stored in Redis.
I think the error you have is because of using JDK 19? Try with JDK 11?
I think the error you have is because of using JDK 19? Try with JDK 11?
JDK 11
Ah my bad, I didn't see the right error: Entity type lonca was not registered
.
All the pods that call registerScoped
need to call registerEntity
for all the entity types.
Yes, It works now.
For example, I have 1000 entities, How much do I pod need? If I have 2 pods or more, propagate is gonna be fifty-fifty to the pods?
Yes, entities will be balanced across all pods. With 2 pods, they will have the same amount of shards, which means similar amount of entities.
How many pods you need depends on many things like pod spec (CPU, memory), how much resource your behavior uses, how many messages, etc.
Okey I understand. Thanks for your help.
how can we develop an example that stores “entity data in memory” with multi-pod configuration. shard assignments data could be stored in redis or memory - it doesn't matter.
espacially want to store entity data in memory with multi-pod config
If you store entity data in memory, when the entity is moved to another pod its state will be reset. But for the sake of the example you can totally do that. But the shard manager needs redis storage if you want to use multiple pods.
Simple Memory Example
GuildApp
GuildAppPod2
simple.ShardManagerApp
GuildApp Pod1
GuildAppPod2
Expected Result
I think it should work with two pods on the memory state
Complex redis examples
GuildBehavior
GuildApp Pod1
GuildAppTwo Pod2
complex.SharManagerApp
GuildApp Pod1
GuildAppTwo Pod2
Expected Result
I can add two entities to the same pod but when I want to add them to two different pods I get an error.
Question
In the Redis example, when I send a message to the entity, does it get the data from the cache / memory or does it pull the data from redis?
So, is the need for redis necessary for the pods to be able to map to each other, or is it also necessary for adding and accessing records?