Effect CommunityEC
Effect Community2mo ago
2 replies
deinsone

Enhancing Shard Assignment and Affinity Flexibility in Effect Cluster

Exploring effect cluster for a while I found a set of use cases difficult to implement with it due to a lack of shard assignment / affinity flexibility - entity-to-entity, workflow-to-entity affinity. That's essential for managing shared stateful resources

As far as I can see, at the moment only group affinity is available via ClusterSchema.ShardGroup annotation, and requires individual runner pre-configuration

I would expect smth like this to be possible, where cluster would manage correct shard id assignment in respect to requested affinity and would take care of failover:

interface AffinityToEntityOptions {
  type: EntityType;
  entityId: EntityId;
  shardGroup?: string = `default`;
  ensuring?: boolena = false; // whether the requested entity should be spawn up if missing
};

// myEntity.annotate(ClusterSchema.AffinityToEntity, [...] as Array<AffinityToEntityOptions>);
myWorkflow.annotate(ClusterSchema.AffinityToEntity, [...] as Array<AffinityToEntityOptions>);


Am I missing anything and this type of behavior can be implemented with smaller effort? I would be willing to contribute if this aligns well with effect cluster
Was this page helpful?