title: AWS SQS + autoscale
body: <p>Assuming that I have a queue and multiple instances in autoscaling group.</p>
  
  <p>For scaling up case, it's quite easy to determine.If the length of the queue grows, autoscaling group will spawn new instances.</p>
  
  <p>For scaling down case, it's a bit tricky here. If the length of the queue shrinks, autoscaling group will terminate the instances. It sounds obvious, but the question is: what happens if the instances which are still processing messages being terminated? </p>
  
  <p>Of course we can use some metrics like CPU Utilisation, Disk Read/Write, etc to check. But I don't think it's a good idea. I'm thinking about a central place where instances will be registered for whether they are processing or not, so that the free ones can be determined and so terminated properly.</p>
  
  <p>Any thoughts for this? Thanks.</p>