Javatpoint Logo
Javatpoint Logo

What is MS Azure Functions?

In order to write less code, manage less infrastructure, and save money we can use Azure Functions which is a serverless computing platform. Rather than worrying about establishing and managing servers, the cloud architecture delivers all of the current resources necessary to keep your apps running.

Azure Functions takes care of the rest of everything we just have to concentrate on the code that matters most us the most.

We frequently design systems to respond to a sequence of crucial events. Every application, whether it's creating a web API, responding to database updates, processing IoT data streams, or simply maintaining message queues, need a means to run code as events occur.

The "compute on demand" is provided in Azure Functions in two methods as per the need.

First, Azure Functions enables you to turn your system's logic into easily accessible code chunks. "Functions" are the name for these code blocks. Various functions can be activated at any time when you need to respond to a vital incident.

Second, when demand grows, Azure Functions scales up to provide as many resources and function instances as needed - but only when they're needed. Any surplus resources and application instances are immediately decommissioned as demand decrease.

What is the source of all the computational resources? Azure Functions can supply as many or as few compute resources as you need to meet the demands of your application.

The serverless computing is defined as the provisioning of compute resources on demand in the Azure Functions.

Scenarios

A function may interface with a variety of cloud services to give feature-rich implementations in various scenarios.

The scenarios listed below are a popular, but not exhaustive, set of Azure Functions scenarios.

If you want to... then...
Build a web API Using the HTTP trigger, create an endpoint for your web apps.
Process file uploads When a file is uploaded or updated in blob storage, run code.
Build a serverless workflow Using durable functions, chain a number of functions together.
Respond to database changes When a document is created or changed in Cosmos DB, run custom logic.
Run scheduled tasks At predetermined intervals, run code.
Create reliable message queue systems Queue Storage, Service Bus, or Event Hubs can all be used to process message queues.
Analyze IoT data streams Data from IoT devices is collected and processed.
Process data in real time Use SignalR and Functions to react to data in real time.

The following options and resources are accessible to you when you develop your functions:

  • Use your preferred language: Create functions in C#, Java, JavaScript, PowerShell, or Python, or create a custom handler to use any language.
  • Automate deployment: There are numerous deployment options available, ranging from a tools-based approach to employing external pipelines.
  • Troubleshoot a function: To acquire insight into your apps, use monitoring tools and testing methodologies.
  • Flexible pricing options: You just pay for your functions while they are operating with the Consumption plan, whereas the Premium and App Service plans provide features for specialized purposes.

Azure Functions enables you to turn your system's logic into easily accessible code chunks. "Functions" are the name for these code blocks.

What do we mean by "durable functions"?

Durable Functions is a serverless computing extension of Azure Functions that allows you to construct stateful functions. Using the Azure Functions programming model, you can construct stateful workflows by creating orchestrator functions and stateful entities by writing entity functions.

Supported languages

The following languages are currently supported by Durable Functions:

  • C#: Precompiled class libraries and a C# script are both available.
  • JavaScript: Only version 2.x of the Azure Functions runtime is supported. Version 1.7.0 or later of the Durable Functions extension is required.
  • Python: Version 2.3.1 or later of the Durable Functions extension is required.
  • F#: F# script and precompiled class libraries The Azure Functions runtime version 1.x only supports F# scripts.
  • PowerShell: Durable Functions support is currently in public preview. Version 2.2.2 or later of the Durable Functions extension is required. Currently, just the following patterns are supported: Async HTTP APIs, function chaining, fan-out/fan-in.

Application patterns

Durable Functions' main purpose is to simplify complex, stateful coordination requirements in serverless systems. The benefit that we can get from Durable Functions in Typical application patterns are -

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

Pattern: Function chaining

A succession of functions executes in a certain order in the function chaining pattern. The output of one function is applied to the input of another function in this way.

What is MS Azure Functions

As seen in the following example, we can utilize Durable Functions to quickly implement the function chaining pattern.

The numbers F1, F2, F3, and F4 in this example are the names of additional functions in the same function app. Control flow can be implemented using standard imperative coding constructs. The execution of code begins at the top and works its way down. We can even use the conditional statements and different loop statements while writing the code as per the need. In try/catch/finally blocks, we can incorporate error handling logic as well.

Pattern: Fan out/fan in

You run numerous functions in parallel in the fan out/fan in pattern, then wait for them all to finish. On the results supplied by the functions, some aggregation work is frequently performed.

What is MS Azure Functions

You can fan out standard functions by having them send several messages to a queue. Returning to the original position is significantly more difficult. To fan in, you build code to track when queue-triggered functions conclude and then store function outputs in a conventional function.

The F2 function's fan-out task is divided across numerous instances. A dynamic list of tasks is used to track the job. Task. It waits for all of the functions that have been called to finish, when All is called. The results of the F2 function are then combined and supplied to the F3 function from the dynamic task list.

The automated checkpointing that occurs when Task is called with an await call. When All ensures that a potential mid-task crash or reboot does not result in the task being restarted.

Pattern: Async HTTP APIs

This type of pattern solves the a very major problem of coordination of the status of long-running activities which is faced by external clients. An HTTP endpoint is a common technique to implement this pattern by triggering the long-running activity. The client is then sent to a status endpoint, which it polls to determine when the process is complete.

What is MS Azure Functions

Durable Functions has built-in support for this pattern, making it easier to interact with long-running function executions and even eliminating the need to write code.

The Durable Functions runtime even manages state for us, so we don't need to create our own status-tracking method.

Built-in HTTP APIs for managing long-running orchestrations are exposed through the Durable Functions extension. A queue message, for example, could be used to initiate termination.


Next TopicWhat is ETL





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA