Search code examples
c#servicebusazure-service-fabric

Scale Service Fabric based on service bus queue size


I have a set of stateless services

These services are connected to service bus

Each service looks at 3 specific service bus queues

What I would like to do is to add the number of messages on across these queues

If the total is above a specific number say 10000 I want to add 2 more instances otherwise I can reduce the instances

Is this possible?

The auto scale functionality of service fabric seems to be more based on resources

Paul


Solution

  • Using the Monitor option in Azure you can set autoscale for any resource. Once you Enable autoscale for your Service Fabric Nodes (not the service fabric itself) you will be able to control the specific metrics you want to base your scale

    Example

    I shared a printscreen from autoscalling on my Service Fabric - in mine it shows EventHub, because I don't use a service bus, but it can be applied to service bus according to the options in the metric source

    for more reference look here: https://learn.microsoft.com/en-us/azure/monitoring-and-diagnostics/monitoring-autoscale-scale-by-custom-metric