Scenario: I have few apps running in PCF
and one of them is a SpringBoot
listener app.
Problem: I need to scale up or down the instances of listener app which is listening to some External MQ
queue based on the queue depth or number of messages.
This is really easy if I use PCF RabbitMQ
, I can have Autoscaler rule setup for RabbitMQ queue and this will work fine. Which I am already doing for other apps.
But I need to use some other External MQ (not RabbitMQ) where external systems are publishing message. So I am curious if PCF platform exposes some kind of endpoints for each app ruining in PCF
that can be used to scale up/down individual apps.
The best you could do is to use a custom metric. To do that, your app would need to monitor the queue length and emit a metric that indicates the queue length. You can use the instructions here to emit a custom metric.
https://docs.pivotal.io/pivotalcf/metric-registrar/using.html
Then once the metric is emitted, you can set up an autoscaler rule using a custom metric. Select the metric name that you emitted. Autoscaler will then use the metric you're emitting to scale your app. See this link for more details on using a custom metric.
https://docs.pivotal.io/pivotalcf/appsman-services/autoscaler/using-autoscaler.html#metric
Hope that helps!