Different types of Queue options in RabbitMQ (Default - Classic - Quorum - Stream)

You might have noticed that while creating a queue in RabbitMQ, there are multiple types you can choose from, let us take a look at each of them in details and when to use them.

Types of Queues in RabbitMQ

1. Default Queues

  • Default queues are the standard queue type used in RabbitMQ. They are often referred to as Classic Queues, which are suitable for most basic use cases.
  • Features:
    • Single Node Storage: Typically stores messages on the single node where the queue is created.
    • Durability Options: Can be configured as durable to persist messages across restarts or non-durable for ephemeral data.
    • Persistence: Messages can be made persistent to survive node restarts.
  • When to Use:
    • General Purpose: Ideal for general messaging scenarios where advanced features of Quorum or Stream queues are not required.
    • Simple Setups: Suitable for single-node or straightforward clustered environments.
    • Low Overhead: When you need minimal overhead and simple configurations.

2. Classic Queues

  • Classic queues are the traditional type of queues in RabbitMQ, using a simple storage model based on a single node's memory and disk storage.
  • Features:
    • Durable: Can be made durable to survive server restarts.
    • Non-durable: Can be non-durable, meaning messages are lost if RabbitMQ crashes.
    • Persistence: Supports message persistence, where messages are written to disk.
    • Single-node Storage: Messages are stored on the node where the queue is created.
  • When to Use:
    • General Use Cases: Suitable for many general messaging scenarios where high availability and data integrity are not critical.
    • Single Node Deployments: Ideal for single-node or simple clustered setups where high availability is not a concern.
    • Low Latency: When you need low latency and the overhead of quorum or stream queues is not justified.

3. Quorum Queues

  • Quorum queues are designed for high availability and data safety, using the Raft consensus algorithm to replicate messages across multiple nodes.
  • Features:
    • High Availability: Replicates messages across a quorum of nodes, providing fault tolerance.
    • Data Safety: Ensures that messages are not lost even if a node fails.
    • Consistency: Uses Raft to ensure consistent state across the cluster.
    • Write & Read Quorum: Requires a majority of nodes to agree on updates, maintaining data consistency.
  • When to Use:
    • High Availability: When you need to ensure message durability and availability in a clustered RabbitMQ setup.
    • Critical Data: Suitable for use cases where losing messages is unacceptable, such as financial transactions or critical notifications.
    • Clustered Environments: Ideal for environments where RabbitMQ is deployed across multiple nodes.

4. Stream Queues

  • Stream queues handle large volumes of data and support high-throughput messaging, optimized for large-scale message streaming.
  • Features:
    • High Throughput: Optimized for high-throughput use cases, such as streaming large volumes of messages.
    • Log-Based Storage: Uses a log-based storage model allowing efficient message replay and retrieval.
    • Message Replay: Supports replaying messages from the log, useful for scenarios needing reprocessing of historical data.
  • When to Use:
    • Large-Scale Data Streaming: Ideal for applications handling large streams of data or requiring efficient message replay capabilities.
    • Event Sourcing: Useful for systems implementing event sourcing, where the history of all events is crucial.
    • Data Analytics: Suitable for real-time data analytics and processing large datasets.

Comments & Discussion

Facing issues? Have questions? Post them here! We're happy to help!