🎭
GoAkt
GithubReference
  • 👋Introduction
  • 🏛️Design Principles
  • 🔢Versioning
  • 💡Use Cases
  • 🚀Get Started
  • 📦Binaries and Go versions
  • features
    • Actor System
    • Actor
    • Mailbox
    • Messaging
    • PipeTo
    • Passivation
    • Supervision
    • Behaviors
    • Remoting and APIs
    • TLS
    • Scheduler
    • Stashing
    • Routers
    • Events Stream
    • Coordinated Shutdown
    • Persistence
    • Observability
    • Testkit
    • Cluster
    • Service Discovery
    • Cluster Singleton
    • Cluster Client
  • Cluster PubSub
  • Extensions
  • Dependencies
  • Meta Framework
    • eGo
Powered by GitBook
On this page
  • Overview
  • Key Characteristics
  • Use Cases
  • Get Started
  1. features

Cluster Singleton

Overview

A Cluster Singleton is to ensure that only one instance of a specific actor runs across an entire cluster. This approach is commonly used for tasks that require centralized coordination, resource management, or maintaining shared state within the cluster.

Key Characteristics

  • Single Instance: Only one instance of the singleton actor is active across all nodes in the cluster.

  • Location: The singleton actor is always created on the oldest node in the cluster.

  • Failover: If the oldest node shuts down or leaves the cluster, the singleton actor is automatically recreated on the next oldest node, ensuring high availability.

  • Default Supervisor: The actor runs under the default actor system supervisor and directive, with no option to assign a custom mailbox.

  • Access: Other actors can interact with the singleton actor using its name (alias).

Use Cases

  • Coordinating distributed tasks to prevent duplicate processing.

  • Managing cluster-wide shared resources, such as distributed locks.

  • Acting as a centralised event aggregator or scheduler within the cluster.

Get Started

  1. Other nodes can send messages to the singleton actor using its name.

This pattern ensures both scalability and reliability while maintaining a single source of truth across the cluster.

PreviousService DiscoveryNextCluster Client

Last updated 3 months ago

Cluster mode is activated via .

Create a singleton actor using the method of the

WithCluster
SpawnSingleton
ActorSystem