What's the timeout for azure service bus triggered function? - azure

My azure functions can take 30-40 minutes to complete.
As you can see in the below image, 230 seconds is the maximum amount of time that an HTTP triggered function.
So, i am trying to create an azure service bus triggered function. Wanted to know about its timeout, any help would be appreciated.
Thanks in advance.

Azure functions running on a consumption plan have a default timeout of 5 minutes, which can be extended to a max of 10 minutes. When using a premium or dedicated plan the default is 30 minutes but the max in unlimited, see the docs. So even your service bus triggered function has a max running time depending on the plan used.
Do mind that for http triggered functions the max runtime is 5 minutes:
Regardless of the function app timeout setting, 230 seconds is the maximum amount of time that an HTTP triggered function can take to respond to a request. This is because of the default idle timeout of Azure Load Balancer. For longer processing times, consider using the Durable Functions async pattern or defer the actual work and return an immediate response.

Related

Azure function Service Bus Trigger concurrency

I'm developing an Azure Function that executes several operations in Dynamics 365 CRM.
I don't fully understand how Azure Functions concurrency works.
I have a Consumption Plan, my Azure Function has a function inside that is triggered by a Service Bus message.
When I tested it the first time, the service bus received around 200 messages and the app started processing a lot of messages at the same time, making a huge load of requests to dynamics 365 that couldn't handle them.
So in the Azure Portal I managed to set the max number of instances to 1, but still the function was processing many messages at one time.
What's the best way to set a limit to that?
Using maxConcurrentCalls in host.json?
Using maxConcurrentSessions in host.json?
Using WEBSITE_MAX_DYNAMIC_APPLICATION_SCALE_OUT in the app configs?
Also, what's the difference between setting maxConcurrentCalls at 10, and 1 function instance or setting it at 5 with 2 function instances?
maxConcurrentCalls is the attribute configured in host.json for the Azure Functions Service Bus Trigger.
By default, the runtime of Functions processes multiple messages concurrently (default value - 16). Set maxConcurrentCalls to 1 for setting up to process only a single queue or topic message at a time by the runtime.
Also, maxConcurrentCalls is the max no. of concurrent calls to the callback that should be initiate per scaled instance.
maxConcurrentSessions - Maximum No. of Sessions handled concurrently per scaled instance.
This setting only applies for functions that receive a single message at a time.
For the requirement of only one message need to be processed at a time per instance than you can use above configuration in the host.json.
If your requirement is Singleton support for Functions to ensure only one function running at a time, then you need to configure this.
WEBSITE_MAX_DYNAMIC_APPLICATION_SCALE_OUT
This setting has no default limit, which states the max no. of instances that the app can scale out to.
Not to Scale out the function and to run only in one instance, set WEBSITE_MAX_DYNAMIC_APPLICATION_SCALE_OUT to 1
In addition to this setting, you need to set maxConcurrentCalls to 1.
Few References for more information:
Azure Function to process only single message at one time
Azure Functions - WEBSITE_MAX_DYNAMIC_APPLICATION_SCALE_OUT and batchSize - how can I get the desired concurrency
azure servicebus maxConcurrentCalls totally ignored
Official documentation of host.json settings in Azure Function Service Bus Trigger explains about maxConcurrentCalls, maxConcurrentSessions
Official Doc explains about WEBSITE_MAX_DYNAMIC_APPLICATION_SCALE_OUT

Time out period for a logic app sitting in multi-tenant environment?

What is total time out period for a logic app sitting in multi-tenant environment?
As I found the information from the link https://learn.microsoft.com/en-us/azure/logic-apps/logic-apps-limits-and-config#http-limits, it gives time out period for each inbound request and responses only.
Here I would like to understand what is the total time out period for entire flow to complete ?
As far as I know, the timeout limit just applies only to some actions(such as HTTP action). For the whole logic app flow, it doesn't exist a limit for timeout. For example, in logic app you can use "Delay" action to delay arbitrary time.
The whole flow will wait the delay action and then continue execute.
By the way, the logic app is not billed by the hour but billed by running actions account, so it will cost more if run for longer.

Azure App Service Plan - What does minutes/day mean?

I have ASMX webservice with 1 MSSQL Database and a Single Table.
I have currently deployed it to Azure in the App Service
I have upgraded from Free Trial to Pay Per Use Plan.
I'm really confused with the App Service Plan
The ASMX Service is called by a Desktop application and it only has a few methods,just to fetch and return data from database.At max 100 users will be using it and may be a maximum of 1000 method calls may be made.
What does 60 minutes/day mean? The webservice can function for only 60 minutes?
I'm really confused.Please advice
Think of the minutes listed similar to a consumption plan on Azure Functions. When your website is responding to requests, it active and your "on the clock." When the site has been idle for a while, it will effectively go to sleep and you are "off the clock." Free and shared tiers are not "Always On". If your compute minute usage exceeds the quota (60 or 240 minutes), then Azure will return a 403 message to the browser and your site is unavailable until the quota resets for the next day. Free and Shared plans are really not designed for production. If you think you can squeeze your 1000 method calls into those time limits, great...it may be a cheaper solution. But you should expect the possibility of a 403 being returned and your request not being fulfilled. If your desktop app is important and really needs this service, you are probably better off paying for Basic (B1).

Azure Function Timeout on Consumption Plan

I've specified a timeout on my http trigger azure functions (v1) by specifying the following in my host.json file
{
"functionTimeout": "00:10:00"
}
I've deployed to Azure using VS2017 and can confirm that this setting now appears in the Azure Portal. I also restarted the function app just to be sure.
When I execute my function, it is always timing out on or around 4 minutes, even though the timeout has been set to 10 minutes
I've ruled out the timeout occurring from other sources as when I test the Azure function locally it does not time out.
Can anyone shed some light on why this is happening?
It is expected. Http request has a fixed timeout setting on Azure site. See Azure Web App timeout setting of 230s. In this aspect, there's no difference between Azure Web app and Http trigger Azure Function.
There is a 230 second (i.e. a little less than 4 mins) timeout for requests that are not sending any data back. After that, the client gets the 500 you saw, even though in reality the request is allowed to continue server side.
As for how to bypass this limitation, if it's not necessary to get an immediate feedback like httpresponse, you can use queue trigger to do your job.
Otherwise, have a look at Durable function. You could send an http request to start an orchestrator and get a response that it starts successfully and so on. The work is being processed in orchestrator and activity function and we don't need to worry about time out(as they are non-http trigger as well).
Azure Functions team at Microsoft has added a configuration option that enables an Azure Functions App to have the timeout increased.
Full answer #Build5Nines.com Azure Functions: Extend Execution Timeout Past 5 Minutes
In short edit host.json and set functionTimeout:
// Set functionTimeout to 10 minutes
{
"functionTimeout": "00:10:00"
}

Is custom storage polling relevant to consumption plan Azure Functions?

How does the concept of storage queue polling apply when an Azure Function is hosted under the consumption plan?
I get the principal of polling with classic hosted WebJob functions and I understand that the maximum polling interval of 1 minute can be overridden. However in the case of consumption plan hosting there is no app-level memory resident process, therefore I assume that Azure internals spin up a FunctionApp via some other trigger beyond my control.
The motivation for this question is that I am trying to understand typical E2E function invocation propagation delays when an Azure hosted WebApp adds a message to a storage queue. In my case the WebApp, StorageQueue and pre-compiled function DLL will run in the same Azure region.
I need to cap Azure Function invocation delays to under 10 seconds with an average of <3 seconds.
Unfortunately this isn't possible on the consumption plan with the current polling model, as we poll your trigger resource every 10s to determine if there are new events requiring a function instance to be loaded/started.
If your function app runs frequently enough that it always has active instances (a new queue message every 5 min, for example) you can get the invocation delays that you want, as the instances themselves handle the polling.
The worst case (no function instances running) is ~10s polling + ~5s instance startup time to process a new event.

Resources