I have an application that performs long running tasks. So it decided to use AWS SQS with Autoscalling policy and CloudWatch.
I read that Amazon SQS queues send metrics to CloudWatch every five minutes. I known that my single task takes 10 seconds. So one worker can handle 30 tasks for five minutes. I would like that message will live as short as possible in SQS. For example:
- if 30 messages are added to SQS I would like to have one worker,
- if 60 messages are added to SQS I would like to have two workers,
- if 90 messages are added to SQS I would like to have three workers,
- etc.
According to documentation I created a AutoScaling policy (that adds 1 instance) and CloudWatch alarm (that fires this policy if there is more than 30 ApproximateNumberOfMessagesVisible). So should I add second ClouldWatch alarm if there is more than 60 message?
Aucun commentaire:
Enregistrer un commentaire