This topic describes the system deployment architecture of SOFAStack Message Queue to help you better understand its high availability.
Message queues offer high scalability because producers, message servers, and consumers are all deployed as clusters. This cluster-based architecture provides high availability (HA), which is the primary feature that distinguishes these message queues from other message servers. When a producer sends a message, the cluster randomly selects a consumer to process it. The delivery is considered successful if that consumer processes the message.
In this topic, the terms "server-side" or "server" refer to message queue components such as Name Server and Broker. The term "server-side" is not equivalent to "Broker".
System deployment architecture
The system deployment architecture is shown in the following figure.

The components in the figure are described as follows:
NameServer: An almost stateless node that can be deployed in a cluster. It provides a naming service for the message queue. This component uses a built-in ZooKeeper for Broker leader election and cluster management.
Broker: A component that stores and forwards messages. Brokers are divided into Master and Slave roles. Each Master Broker can have multiple Slave Brokers, but each Slave Broker is associated with only one Master Broker. After a Broker starts, it registers with the Name Server and then reports its topic routing information to the Name Server every 30 seconds.
Producer: Establishes a persistent connection (keep-alive) with a random node in the Name Server cluster to periodically read topic routing information. The producer also establishes a persistent connection with the Master Broker that provides the topic and sends regular heartbeats to it.
Consumer: Establishes a persistent connection with a random node in the Name Server cluster to periodically pull topic routing information. It also establishes persistent connections with the Master and Slave Brokers that provide the topic and sends regular heartbeats to them. A consumer can subscribe to messages from either the Master Broker or a Slave Broker, based on the subscription rules defined in the Broker configuration.
SOFAMQ also includes the following two components, which are not shown in the figure. Their main features are as follows:
Console: The graphical management console for SOFAMQ.
Router: A component that enables LDC capabilities for SOFAMQ. In LDC scenarios, it forwards messages between logical units according to configured router rules.
More information
For more information about Message Queue concepts, see Glossary.