All concepts
Ordering & dedup

Message Group ID (FIFO)

The partition key that controls per-group ordering and parallelism.

Why it matters

FIFO ordering is per-group. Choosing the right MessageGroupId is the single most important decision for throughput in a FIFO design.

What it is

MessageGroupId is a required attribute for FIFO queues. Amazon SQS uses it as input to an internal hash function to determine partition placement and to enforce strict ordering — messages with the same group ID are processed in sequence by one consumer at a time.

Ordering guarantee

Messages sharing a MessageGroupId are delivered strictly in order. Different groups are processed in parallel. While a message in a group is in-flight, no subsequent message in that group is available to consumers.

Choosing a group ID

Pick a value that captures the strict ordering dependency — typically an entity ID such as userId, orderId, or vehicleId. AWS recommends message group IDs with a large number of distinct values for uniform partition distribution.

  • Per-customer ordering: use customerId.
  • Per-order workflow: use orderId.
  • Avoid a constant value — serializes the entire queue through one consumer.
  • Avoid a unique UUID per message — loses meaningful ordering and behaves like standard.

Throughput and partitions

High-throughput FIFO queues distribute messages across partitions based on the hash of MessageGroupId. Each partition supports up to 300 messages/sec (3,000 with batching) per operation in supported regions. More distinct group IDs → better parallelism.

Batching tip

When using SendMessageBatch, batch messages with the same MessageGroupId when possible to optimize partition utilization. SQS only guarantees grouping of same-group messages within a batch when the hash routes them together.

Gotchas
  • !A constant MessageGroupId throttles you to one consumer for the entire queue.
  • !A high-cardinality group ID per message (UUID) effectively makes the queue behave like standard — you lose meaningful ordering.
  • !A poison message in a hot group blocks all subsequent messages in that group until visibility timeout expires.
Try the FIFO group-ID lab
Apply this concept to a broken system.
open →