Azure Functions Flashcards

1
Q

What are “bindings” in Azure Functions?

A

Bindings give you declarative access to a wide variety of Azure and third-party services for integration.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What pricing models are available for Azure Functions?

A

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.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the default pricing model for Azure Functions?

A

Consumption plan

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Which settings should be enabled if you use App Service plan for Azure Functions?

A

“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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What property controls Function App timeout?

A

The timeout duration of a function app is defined by the functionTimeout property in the host.json project file.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the maximum timeout for HTTP triggered function?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What kind of Storage Account is required for Azure Functions?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Where are the Function code files stored?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the limit of Consumption plan per instance?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What component of Azure Functions helps in scaling?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the unit of scale in Azure Functions?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is cold start for Azure Functions?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

If there is a lot of cold start issues with Azure Functions, what can you do to solve it?

A

If cold starts are impacting your functions, consider running in a Premium plan or in a Dedicated plan with Always on enabled.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How many maximum instances can Azure Function be scaled to in the Consumption plan?

A

200 instances

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Is there any limit on the number of concurrent execution of Azure functions?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

For Azure Function with HTTP trigger, at what rate can the new instances be allocated?

A

For HTTP triggers, new instances are allocated, at most, once per second.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

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?

A

For non-HTTP triggers, new instances are allocated, at most, once every 30 seconds. Scaling is faster when running in a Premium plan.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What is the most effective way of setting scaling for Azure Functions with Service Bus triggers?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What are the units of billing for Azure Functions?

A

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.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

What are the benefits of the Consumption plan for Azure Functions?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What are the benefits of Premium Plan for Azure Functions?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

When should you use Dedicated Plan for Azure Functions?

A

Run your functions within an App Service plan at regular App Service plan rates. Good fit for long running operations, as well as when more predictive scaling and costs are required. Consider an App Service plan in the following situations:
✔ You have existing, underutilized VMs that are already running other App Service instances.
✔ You want to provide a custom image on which to run your functions.

23
Q

When should you use ASE for Azure Functions?

A

App Service Environment (ASE) is an App Service feature that provides a fully isolated and dedicated environment for securely running App Service apps at high scale. ASEs are appropriate for application workloads that require:
✔ Very high scale.
✔ Isolation and secure network access.
✔ High memory utilization.

24
Q

What are the benefits of Kubernetes Plan for Azure Functions?

A

Kubernetes provides a fully isolated and dedicated environment running on top of the Kubernetes platform. Kubernetes is appropriate for application workloads that require:
✔ Custom hardware requirements.
✔ Isolation and secure network access.
✔ Ability to run in hybrid or multi-cloud environment.
✔ Run alongside existing Kubernetes applications and services.

25
Q

How many maximum instances can Azure Function be scaled to in the Premium plan?

A

100 instances

26
Q

How many maximum instances can Azure Function be scaled to in the Dedicated plan?

A

10-20 instances

27
Q

How many maximum instances can Azure Function be scaled to in the ASE plan?

A

100 instances

28
Q

What is the default and maximum timeout for Azure Function in Consumption plan?

A

Default: 5mins and Max: 10mins

29
Q

What is the default and maximum timeout for Azure Function in plans other than Consumption?

A

Default: 30mins and max: unbounded

30
Q

What are the maximum outbound connections per instance for Azure Functions in the Consumption plan?

A

600 active and 1200 total

31
Q

What is the maximum ACU per instance for Azure Functions?

A

100 ACUs

32
Q

How many function apps per plan can be there for Azure Functions in Consumption and Premium plan?

A

100 functions/plan

33
Q

What are Durable Functions?

A

Durable Functions is an extension of Azure Functions that lets you write stateful functions in a serverless compute environment. The extension lets you define stateful workflows by writing orchestrator functions and stateful entities by writing entity functions using the Azure Functions programming model. Behind the scenes, the extension manages state, checkpoints, and restarts for you, allowing you to focus on your business logic.

34
Q

What application patterns are supported by Durable Functions?

A
  • Function chaining
  • Fan-out/fan-in
  • Async HTTP APIs
  • Monitoring
  • Human interaction
  • Aggregator (stateful entities)
35
Q

What is Azure Function Chaining?

A

In the function chaining pattern, a sequence of functions executes in a specific order. In this pattern, the output of one function is applied to the input of another function.

36
Q

What is Azure Function Fan-out/Fan-in?

A

In the fan out/fan in pattern, you execute multiple functions in parallel and then wait for all functions to finish. Often, some aggregation work is done on the results that are returned from the functions.

37
Q

What is Azure Function Async HTTP APIs?

A

The async HTTP API pattern addresses the problem of coordinating the state of long-running operations with external clients. A common way to implement this pattern is by having an HTTP endpoint trigger the long-running action. Then, redirect the client to a status endpoint that the client polls to learn when the operation is finished.

38
Q

What is Azure Function Monitor pattern?

A

The monitor pattern refers to a flexible, recurring process in a workflow. An example is polling until specific conditions are met. You can use a regular timer trigger to address a basic scenario, such as a periodic cleanup job, but its interval is static and managing instance lifetimes becomes complex. You can use Durable Functions to create flexible recurrence intervals, manage task lifetimes, and create multiple monitor processes from a single orchestration.

39
Q

What is Azure Function Human-interaction pattern?

A

This pattern is implemented by using an orchestrator function. The orchestrator uses a durable timer to request approval. The orchestrator escalates if timeout occurs. The orchestrator waits for an external event, such as a notification that’s generated by a human interaction.

40
Q

What is Azure Function Aggregator pattern?

A

pattern is about aggregating event data over a period of time into a single, addressable entity. In this pattern, the data being aggregated may come from multiple sources, may be delivered in batches, or may be scattered over long-periods of time. The aggregator might need to take action on event data as it arrives, and external clients may need to query the aggregated data.

41
Q

What open-source technology is used under the Azure Durable Functions?

A

Behind the scenes, the Durable Functions extension is built on top of the Durable Task Framework, an open-source library on GitHub that’s used to build workflows in code. Like Azure Functions is the serverless evolution of Azure WebJobs, Durable Functions is the serverless evolution of the Durable Task Framework. Microsoft and other organizations use the Durable Task Framework extensively to automate mission-critical processes. It’s a natural fit for the serverless Azure Functions environment.

42
Q

What are the code constraints for building Orchestrator Functions?

A

Orchestrator functions use event sourcing to ensure reliable execution and to maintain local variable state. The replay behavior of orchestrator code creates constraints on the type of code that you can write in an orchestrator function

  • Using deterministic APIs - it’s important that orchestrator functions call only deterministic APIs. A deterministic API is an API that always returns the same value given the same input, no matter when or how often it’s called.
  • Versioning - A durable orchestration might run continuously for days, months, years, or even eternally. Any code updates made to Durable Functions apps that affect unfinished orchestrations might break the orchestrations’ replay behavior. That’s why it’s important to plan carefully when making updates to code
  • Durable tasks - Tasks that can safely wait in orchestrator functions are occasionally referred to as durable tasks
43
Q

Which technology manages Durable tasks?

A

The Durable Task Framework creates and manages these tasks.

44
Q

Why can’t an Orchestrator Function use await or yield in a non-durable task?

A

There are two reasons: the dispatcher thread can’t wait for the task to finish, and any callback by that task might potentially corrupt the tracking state of the orchestrator function. Some runtime checks are in place to help detect these violations.

45
Q

Which exception is raised when the Durable Task Framework detect violation of rules of deterministic APIs?

A

The framework throws a NonDeterministicOrchestrationException exception.

46
Q

What is Durable Entity function?

A

Entity functions define operations for reading and updating small pieces of state, known as durable entities. Like orchestrator functions, entity functions are functions with a special trigger type, entity trigger.

47
Q

What are different types of Durable function?

A
  • Orchestrator functions
  • Activity functions
  • Entity functions
  • Client functions
48
Q

What is a Durable Client function?

A

The primary way to deliver messages to trigger Orchestration or Entity fucntion is by using an orchestrator client binding or an entity client binding from within a client function. Any non-orchestrator function can be a client function.

49
Q

What is a Durable Activity function?

A

Activity functions are the basic unit of work in a durable function orchestration. Activity functions are the functions and tasks that are orchestrated in the process.

50
Q

What is a task hub in Azure functions?

A

A task hub in Durable Functions is a representation of the current state of the application in storage, including all the pending work. While a function app is running, the progress of orchestration, activity, and entity functions is continually stored in the task hub. This ensures that the application can resume processing where it left off, should it require to be restarted after being temporarily stopped or interrupted for some reason. Also, it allows the function app to scale the compute workers dynamically.

51
Q

How does Orchestrator function attain high-reliability?

A

Orchestrator functions reliably maintain their execution state by using the event sourcing design pattern. Instead of directly storing the current state of an orchestration, the Durable Task Framework uses an append-only store to record the full series of actions the function orchestration takes.

52
Q

What are Azure Function custom handlers?

A

Custom handlers are lightweight web servers that receive events from the Functions host.

53
Q
A