Azure Functions Flashcards
What are “bindings” in Azure Functions?
Bindings give you declarative access to a wide variety of Azure and third-party services for integration.
What pricing models are available for Azure Functions?
Azure Functions has three kinds of pricing plans. Choose the one that best fits your needs:
- Consumption plan: Azure provides all of the necessary computational resources. You don’t have to worry about resource management, and only pay for the time that your code runs.
- Premium plan: You specify a number of pre-warmed instances that are always online and ready to immediately respond. When your function runs, Azure provides any additional computational resources that are needed. You pay for the pre-warmed instances running continuously and any additional instances you use as Azure scales your app in and out.
- App Service plan: Run your functions just like your web apps. If you use App Service for your other applications, your functions can run on the same plan at no additional cost.
What is the default pricing model for Azure Functions?
Consumption plan
Which settings should be enabled if you use App Service plan for Azure Functions?
“Always On” should be set when using App Service plan so that the function runs correctly. On an App Service plan, the functions runtime goes idle after a few minutes of inactivity, so only HTTP triggers will “wake up” your functions. Always on is available only on an App Service plan. On a Consumption plan, the platform activates function apps automatically.
What property controls Function App timeout?
The timeout duration of a function app is defined by the functionTimeout property in the host.json project file.
What is the maximum timeout for HTTP triggered function?
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.
What kind of Storage Account is required for Azure Functions?
On any plan, a function app requires a general Azure Storage account, which supports Azure Blob, Queue, Files, and Table storage. These accounts, which include blob-only storage accounts (including premium storage) and general-purpose storage accounts with zone-redundant storage replication, are filtered-out from your existing Storage Account selections when you create a function app.
Where are the Function code files stored?
Function code files are stored on Azure Files shares on the function’s main storage account. When you delete the main storage account of the function app, the function code files are deleted and cannot be recovered.
What is the limit of Consumption plan per instance?
Each instance of the Functions host in the Consumption plan is limited to 1.5 GB of memory and one CPU. An instance of the host is the entire function app, meaning all functions within a function app share resource within an instance and scale at the same time.
What component of Azure Functions helps in scaling?
Azure Functions uses a component called the scale controller to monitor the rate of events and determine whether to scale out or scale in. The scale controller uses heuristics for each trigger type.
What is the unit of scale in Azure Functions?
The unit of scale for Azure Functions is the function app. When the function app is scaled out, additional resources are allocated to run multiple instances of the Azure Functions host. Conversely, as compute demand is reduced, the scale controller removes function host instances. The number of instances is eventually scaled in to zero when no functions are running within a function app.
What is cold start for Azure Functions?
After your function app has been idle for a number of minutes, the platform may scale the number of instances on which your app runs down to zero. The next request has the added latency of scaling from zero to one. This latency is referred to as a cold start. The number of dependencies that must be loaded by your function app can impact the cold start time. Cold start is more of an issue for synchronous operations, such as HTTP triggers that must return a response.
If there is a lot of cold start issues with Azure Functions, what can you do to solve it?
If cold starts are impacting your functions, consider running in a Premium plan or in a Dedicated plan with Always on enabled.
How many maximum instances can Azure Function be scaled to in the Consumption plan?
200 instances
Is there any limit on the number of concurrent execution of Azure functions?
A single instance may process more than one message or request at a time though, so there isn’t a set limit on the number of concurrent executions.
For Azure Function with HTTP trigger, at what rate can the new instances be allocated?
For HTTP triggers, new instances are allocated, at most, once per second.
For Azure functions with non-HTTP triggers, what is the rate of new instance allocation, and what can we do to increase that if required?
For non-HTTP triggers, new instances are allocated, at most, once every 30 seconds. Scaling is faster when running in a Premium plan.
What is the most effective way of setting scaling for Azure Functions with Service Bus triggers?
For Service Bus triggers, use Manage rights on resources for the most efficient scaling. With Listen rights, scaling isn’t as accurate because the queue length can’t be used to inform scaling decisions.
What are the units of billing for Azure Functions?
The following are units for billing:
- Resource consumption in gigabyte-seconds (GB-s). Computed as a combination of memory size and execution time for all functions within a function app.
- Executions. Counted each time a function is executed in response to an event trigger.
What are the benefits of the Consumption plan for Azure Functions?
Scale automatically and only pay for compute resources when your functions are running. On the Consumption plan, instances of the Functions host are dynamically added and removed based on the number of incoming events.
✔ Default hosting plan.
✔ Pay only when your functions are running.
✔ scale-out automatically, even during periods of high load.
What are the benefits of Premium Plan for Azure Functions?
While automatically scaling based on demand, use pre-warmed workers to run applications with no delay after being idle, run on more powerful instances, and connect to VNETs. Consider the Azure Functions Premium plan in the following situations, in addition to all features of the App Service plan:
✔ Your function apps run continuously, or nearly continuously.
✔ You have a high number of small executions and have a high execution bill but low GB second bill in the Consumption plan.
✔ You need more CPU or memory options than what is provided by the Consumption plan.
✔ Your code needs to run longer than the maximum execution time allowed on the Consumption plan.
✔ You require features that are only available on a Premium plan, such as virtual network connectivity.