1
votes

I have an Azure Function that is hooked up to a Service Bus queue. It receives a message and generates records to save in an Azure Table storage.

The Service Bus queue currently has a lot of messages:

Service Bus queue

Since there are a lot of pending messages, I would expect the scaling of the Azure Functions to happen, however it does not seem to be the case:

Azure Function metrics

There is only one instance of the Function running and I expected more to help empty the queue.

As specified in the Azure Function's documentation on scaling when using a service bus, I made sure the policy used by the Azure Function included the Manage rights to help scaling:

Service bus queue policy

Question

Why is my Azure Function running on a Consumption Plan not scaling to help dequeue all the messages from the Service Bus?

Update

Here is an extract of the Azure Function:

public static class RecordImporter
{
    private static readonly IImporter Importer;

    static RecordImporter()
    {
        Importer = new AzureTableImporter();
    }

    [FunctionName("Importer")]
    public static async Task Run([ServiceBusTrigger("records ", Connection = "serviceBusConnectionString")] string serializedRecords, ILogger log)
    {
        var records = JsonConvert.DeserializeObject<List<Record>>(serializedRecords);
        await Importer.AddRecordsAsync(records);
    }
}
1
Could you show your Function code/configuration? This does seem a bit odd, normally an SB triggered function should scale up as the scale controller sees more and more messages in the queue..juunas
@juunas I have included the code of the Azure Function.Kzrystof
Hi, any update? Can you scale now?1_1
@BowmanZhu Nope... I wonder if the use of a ServiceBus Queue is the reason why it does not scale... Will try with a Topic instead.Kzrystof

1 Answers

0
votes

Just an idea, because some people face the similar problem with service bus trigger scale out:

https://github.com/microsoft/azure-pipelines-tasks/issues/6759

I notice you are using C#, so please do this when publish:

enter image description here

enter image description here

enter image description here

(Clear the Run from package file check box. By default, VS uses Zip deployment, which can be changed to Web deployment through the above steps.)