Skip to content

Latest commit

 

History

History
48 lines (32 loc) · 4.14 KB

cluster_synchronization.md

File metadata and controls

48 lines (32 loc) · 4.14 KB

Redis and ZooKeeper Cluster Synchronization

Asset synchronization lets SEMOSS nodes refresh local copies when engines, projects, or other shared assets change. The current abstraction is IClusterSynchronizer, with Redis and ZooKeeper implementations.

Select a backend

Setting Purpose
SEMOSS_IS_CLUSTER Enables cloud/shared-asset behavior in the configured deployment
SEMOSS_IS_CLUSTER_REDIS Selects Redis asset synchronization
SEMOSS_IS_CLUSTER_ZK Selects ZooKeeper asset synchronization
Storage-provider settings Select the central storage backend and connection details
HOST_IP in the Compose examples Gives each application node a distinct advertised identity

Configure one asset coordination backend. ClusterSynchronizerFactory chooses Redis first if both flags are enabled and logs a warning; relying on that precedence makes deployment intent unclear.

Use the exact settings in the Redis Compose example or ZooKeeper Compose example. A single node can use shared object storage without either synchronization backend.

Implementations

Component Responsibility
ClusterUtil Entry points used by core operations to synchronize assets
CentralCloudStorage Transfer files to/from the configured storage backend
IClusterSynchronizer Common coordination contract
RedisClusterSynchronizer Redis-backed notifications and coordination
ZKClusterSynchronizer ZooKeeper/Curator-backed notifications and coordination

At a high level, a node updates its working copy, pushes the relevant assets, and publishes a change. Other nodes process the notification and refresh applicable loaded resources. The synchronizer carries coordination information; asset contents come from central storage.

The exact push/pull operation depends on the resource and mutation. Consult its ClusterUtil call and synchronizer implementation instead of assuming every filesystem write automatically publishes a change.

Distinguish agent and room coordination

Redis also serves separate room/agent features:

  • RoomMessageStore can use Redis as a hot projection and coordination layer while persisting conversation history in ROOM.MESSAGES.
  • The cached projection is disposable. Each write sets a sliding expiry of ROOM_MESSAGE_REDIS_TTL_HOURS (default 1), and the projection is evicted when a room is deleted, a guardrail closes it, or the user's session ends (logout or timeout). A missing projection reloads from ROOM.MESSAGES on the next read. Lock and turn-lease keys keep their own TTLs.
  • ClusterRoomTurnLock uses Redis for a renewable per-room agent lease when AGENT_RUN_QUEUE_ENABLED is enabled. The default follows Redis availability; an explicit opt-in still requires Redis.
  • AGENT_RUN_ACTIVE_TTL_MS controls that lease's lifetime, not an agent's execution budget.

ZooKeeper asset synchronization alone does not enable these Redis services. Neither backend turns the process-local agent event buffer into a durable event log. See agent runs.

Verification

Run one of the two-node examples and check both nodes' startup logs for the intended backend and unique identities. Perform a supported resource update, confirm its central-storage copy, and verify that the other node refreshes the corresponding resource. Separately test room turns and live polling if the deployment uses agents across nodes.

For complete infrastructure examples, see SEMOSS-deployment. For asset layout and transfer responsibilities, see central storage.