I'm attempting to lock down internal documentation for best-practices when a function that is triggered by a queue needs to call a 3rd party API where throttling may be a concern. I've followed all the documentation I can find, whether MS official, stackoverflow or from the appropriate github repo.
I have used the CLI to set functionAppScaleLimit=1
az resource update --resource-type Microsoft.Web/sites -g resourceGroupName -n functionAppName/config/web --set properties.functionAppScaleLimit=1
I manually set WEBSITE_MAX_DYNAMIC_APPLICATION_SCALE_OUT to 1 in app settings.
I verified in Azure portal that under scale out settings the function app shows manual scale out and instance count of 1.
I have the following in host.json (I am not using FunctionsStartup attribute)
{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingExcludedTypes": "Request",
"samplingSettings": {
"isEnabled": true
}
},
"extensions": {
"serviceBus": {
"prefetchCount": 1,
"messageHandlerOptions": {
"autoComplete": true,
"maxConcurrentCalls": 1,
"maxAutoRenewDuration": "00:05:00"
},
"sessionHandlerOptions": {
"autoComplete": true,
"messageWaitTimeout": "00:00:30",
"maxAutoRenewDuration": "00:55:00",
"maxConcurrentSessions": 1
}
}
}
}
}
My service bus queue is session enabled. Messages process successfully in the function app (artificial delay added to test concurrency. However, when I test and send 100 messages to the queue (one at a time, not batched and my function is not setup to receive batched messages), 10 per session, I see all 10 sessions processing at the same time. I would expect to see one message from one session processing at any given time.
Any suggestions? Am I missing something obvious?
On a side note, during function execution, if I'm not using FunctionsStartup execution, what's the easiest way to log all settings including those from host.json that are actually used by the function?