1

I'm running an application in the cloud with fairly elastic demand and need to make use of auto-scaling.

The application uses a pub/sub system to receive and process job requests. Each server subscribes to a queue and picks jobs off of that queue one-by-one until the queue is empty.

I'd like to be able to look at the length of the queue (how many jobs are currently enqueued) and create a policy along the lines of:

"If the length of the queue is longer than X, scale up. If the length of the queue is 0 (and has been for a specified amount of time) scale down.

The length of the queue can be found via an HTTP request to the server. The application has an endpoint that describes each queue and their current length in a JSON format.

I've been looking for a service/application that can do this, but haven't found much. I kind of get the feeling I'm going to need to code. Thought I'd ask here first in case anyone knew of a solution.

Side ask: Is this a problem people have ran into in the past? It seems like specific scaling policies like this are fairly common. If I do go the development route, would open-sourcing be useful?

jmkmay
  • 211
  • 2
  • 7
  • In the AWS world, you'd publish the queue size to a CloudWatch metric, and set up auto-scaling rules based on that metric. It's very possible to auto-scale based on queue size, but I think your focus on "polling a JSON endpoint" may be ruling out pretty much all of the existing solutions. – ceejayoz Jun 26 '18 at 14:52
  • Yea I came across using CloudWatch metrics to produce Alerts which can trigger auto-scaling. Problem is you need something to change the metric. A cron job can do this using cli, but I don't think it will be able to make HTTP request and parse the JSON response... – jmkmay Jun 26 '18 at 16:03
  • You could *absolutely* do that in a cron job. `curl` plus https://stackoverflow.com/questions/1955505/parsing-json-with-unix-tools. – ceejayoz Jun 26 '18 at 16:06
  • Interesting. I didn't think of using Python as a scripting language and have cron just executing those scripts. That actually might be the best way to go about doing this. My only concern would be about how well this scales. Is it common to use cron for automating enterprise level tasks like this? Seem kind of like a quick-n-dirty solution. – jmkmay Jun 27 '18 at 15:57

0 Answers0