AWS SQS Average Backlog is defined as the AWS SQS pending queue length averaged over all replicas that the autoscaler is designed to maintain.
The pending queue length refers to the number of messages that are currently in the queue but have not yet been processed. These are messages waiting to be consumed and processed by the relevant workers or services.
The average backlog is the average or mean value of the pending queue length across multiple replicas. In a distributed and auto-scaling system, there can be multiple instances or replicas of your service, each with its own queue. The average backlog provides a way to measure the workload across all replicas.
This Average Backlog is a valuable metric for determining how to scale your application efficiently.
This metric is only available in case you are using AWS SQS for your input queue
- Threshold (Queue Lag Threshold): Upper limit of the number of backlog messages the auto-scaler will try to maintain per replica. If you set this number to 10 and have 30 messages in the queue and one replica, the auto-scaler will scale the number of replicas to 3.
Configuring AWS SQS Backlog Metric:
- In the Deployment Form, find the
Show advanced fieldstoggle button at the bottom.
- Once activated, the Replicas Section will become visible.
- Enable the
Enable Autoscalingtoggle .
AWS SQS Average BacklogAutoscaling Metric should be preselected.
- Set the value of
In your Service deployment code
deploy.py, include the following:
from servicefoundry import AsyncServiceAutoscaling, SQSQueueMetricConfig ... service = AsyncService( ... replicas = AsyncServiceAutoscaling( min_replicas=1, max_replicas=3, metrics=SQSQueueMetricConfig( queue_length=30 ), cooldown_period=300, polling_interval=30 ) ... ) ...
In your Service deployment configuration
servicefoundry.yaml, include the following:
... replicas: min_replicas: 1 max_replicas: 3 metrics: type: sqs queue_length: 30 cooldown_period: 300 polling_interval: 30 ...
Updated 2 days ago