简体   繁体   English

AWS SQS +自动缩放

[英]AWS SQS + autoscale

Assuming that I have a queue and multiple instances in autoscaling group. 假设我在自动缩放组中有一个队列和多个实例。

For scaling up case, it's quite easy to determine.If the length of the queue grows, autoscaling group will spawn new instances. 对于扩展大小写,很容易确定。如果队列长度增加,自动缩放组将生成新实例。

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? 这听起来很明显,但问题是:如果正在处理消息的实例被终止,会发生什么?

Of course we can use some metrics like CPU Utilisation, Disk Read/Write, etc to check. 当然,我们可以使用一些指标,如CPU利用率,磁盘读/写等来检查。 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. 我正在考虑一个中心位置,在这里,实例将被注册,无论它们是否正在处理,以便可以确定免费的实例并正确终止。

Any thoughts for this? 有什么想法吗? Thanks. 谢谢。

The accepted answer on this thread: 在这个帖子上接受的答案:

Amazon Auto Scaling API for Job Servers 用于作业服务器的Amazon Auto Scaling API

gives you two possibilities to handle your situation. 为您提供两种处理您情况的可能性。 One of them should work for you. 其中一个应该适合你。 Also keep in mind, that you don't necessarily want to kill and instance as soon as there is no work - when they spin up, you are going to pay for the whole hour wether you use 59 minutes or 1 minute, so you may want to build that into your solution - spin up instances fast, turn them off slowly. 还要记住,一旦没有工作,你不一定想要杀死和实例 - 当他们旋转时,你将花费整整一个小时来使用59分钟或1分钟,所以你可以想要将其构建到您的解决方案中 - 快速启动实例,慢慢关闭它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM