We have a Linux Function App which consumes messages from Azure Service Bus using a ServiceBusTrigger.
When a message is added to a subscription on ASB, it takes a full minute for the function app to start up in response. Once warm all subsequent messages are consumed very quickly, but surely a cold start does not explain a minute's delay?
2/3/2021, 8:45:22.936 AM | MyApi.DataAccess.ServiceBus.ServiceBusClient | West Europe | Successfully published message to AzureServiceBus
2/3/2021, 8:46:24.000 AM | Host.Startup | | Loading functions metadata
I can replicate this again and again consistently, the delay is almost exactly a minute always, and only happens when the function is cold. Again cold starts are understandable, but the delay in this case is huge - there must be something else going on. A few things to note:
- We are using the Linux Consumption Plan (tried Windows but saw huge delays also)
- We are using Azure Service Bus SessionIds
- We are using functions V3
- There are 9 consumer functions as part of the function app
- In Azure Portal the function app shows as having no functions in the Functions section (this might just be expected for Linux, as the UI also says "Editing functions in the Azure portal is not supported for Linux Consumption Function Apps.")
Here's what the signature of one our consumer functions looks like:
[FunctionName("MyEventHandler")]
public async Task Run([ServiceBusTrigger("MyEvent",
Consts.ServiceBus.SubscriptionName,
Connection = "ServiceBusConnectionString",
IsSessionsEnabled = true)]
MyMessage message,
ILogger log)
What would be nice is if we could see when the function first realises there's a message on the subscription, or how often it's polling the subscription. Is this available anywhere?