- Newest
- Most votes
- Most comments
Hello,
Thank you for contacting us.
Kindly allow me to elaborate how fair queues operate in Amazon SQS standard queues.
Amazon SQS fair queues automatically mitigates the noisy-neighbor impact in multi-tenant queues that contain messages from multiple tenants. Noisy neighbor impact occurs when one tenant in a multi-tenant queue creates a backlog, by sending a larger volume of messages than other tenants, or when consumers take longer to process messages from that particular tenant. This increases the message dwell time for all other tenants.
-
Here's what's happening in your scenario, which is in a steady state condition, a multi tenant queue is in steady state when the queue has no backlog, and all the in-flight messages are evenly distributed among tenants. When Tenant1 sends 1000 messages first, followed by Tenant2 and Tenant3, the system is working as designed by processing Tenant1's messages first. Standard queues provide a loose-FIFO capability that attempts to preserve the order of messages. This way, the dwell time of messages is low for all tenants.
-
Now consider a noisy tenant scenario in which the number of messages of Tenant1 increases significantly and creates a backlog in the queue. Consumers are busy processing the messages mostly from Tenant1, and messages from other tenants are waiting in the backlog, leading to a higher dwell time for all tenants. In this scenario, Amazon SQS fair queues considers this tenant as a noisy neighbor and prioritizes returning messages belonging to the other tenants.
Fair queues help maintain consistent dwell time across tenants by reordering messages when a single tenant causes a queue backlog. If one tenant sends a disproportionately large volume of messages or has messages requiring longer processing time, the queue will then prioritize delivering messages from other tenants to ensure they don't experience excessive delays. This is detailed in the documentations [1] and [2].
Message producers can add a tenant identifier by setting a "MessageGroupId" on an outgoing message: The property of fair queue will be applied automatically in all Amazon SQS standard queues for messages with the "MessageGroupId" property. You don't need to use a FIFO queue for fair queuing, as mentioned in this documentation [3]. In fact, fair queues are specifically designed for standard queues. With standard queues using "MessageGroupId", messages with the same "MessageGroupId" can still be processed in parallel, maintaining high throughput.
To properly test fair queuing, try simulating a ‘noisy neighbor’ scenario where one tenant is continuously sending messages while others are also sending messages. You should then see the system prioritizing messages from the non-noisy tenants to maintain their quality of service.
No changes to your consumer code are required. The fairness capability is applied automatically in all Amazon SQS standard queues for messages with the "MessageGroupId" property.
References:
- https://aws.amazon.com/blogs/compute/building-resilient-multi-tenant-systems-with-amazon-sqs-fair-queues/
- https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-fair-queues.html
- https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/using-messagegroupid-property.html
Relevant content
- asked a year ago
- asked a year ago
- asked 2 years ago
- AWS OFFICIALUpdated 5 years ago

This is not answering the question. I have the same situation for my client currently.