Microsoft has introduced state concepts into previously stateless Azure functions, Microsoft’s serverless computing platform. Adding states gives developers new opportunities to use Azure features.
What’s Latest in Azure Functions: Durable States, Serverless computing
At first glance, Azure functions are comparable with Amazon AWS Lambda. They both have similar programming models that are managed by events, but Azure functions now begin to show their own colors as the primary function of the PaaS offer from Azure. This is partly the result of the Microsoft decision to use Azure functions at the center of the message-based programming platform, which is part of a set of tools that includes Service Fabric and the Event-Grid environment for publishing and subscriptions.
Adding state to serverless in Azure Functions
The last update of the Azure functions is interesting, because it takes what was in its heart without citizenship and adds state. In those cases where the standard function is best perceived as transferring software from one input, processing, and then processing the appropriate actions, the new durable functions are what Microsoft calls “the functions of the orchestras.” Instead of a single switch, the function performs a number of functions and wraps them as a single long transaction, creating a workflow for managing actions and processing expectations by suspending this function.
One of the advantages of Azure Functions is its payment model per second, where you only pay for the calculation that you use. This model is transferred to strong functions when you are charging when the workflow is running. If it is suspended, waiting for input, there is no fee. And when it is suspended, it keeps its state from outside, so if the host process is restored or the virtual machine on which the function is located is rebooted, your function can pick up and continue.
Keeping Azure Functions state’s external
The presence of a way to externalize the state is very important, because it is important to avoid workarounds necessary to create a state on a platform without a state, such as Azure Functions. When you call a function, you can not control where it was created, and you can not control how long it will be available. If the base platform should return the container used to place the function, it is lost. But if it saves the state, the replace function can raise it and continue, as if it were the same function that stored the data.
Under the hood, durable functions are based on familiar Azure concepts, preserving the state in the storage queues and in the table storage. But this is only the beginning, and you can expect the emergence of alternative storage options in the future, with emphasis on improving productivity.
Latest serverless patterns in Azure Functions
Chain functions are only one option. Where everything becomes interesting, what Microsoft calls fan / fans is used. This is a way to use strong functions to work concurrently with parallel operations, run a trigger, and run multiple functions and wait for them to complete before processing the results and using them to start the final action.
The task list in the parent long-term function keeps track of all the functions started as part of the branching operation, starting when they are all completed. The actions of the fan are control points, the recording state, and the suspension of the parent durable function when executing its child processes.
When you look at the durable functions in detail, you can see that they are very similar to the reliable participants used in Service Fabric. This similarity is very clear when you look at some of the more complex design patterns, for example, the syntax with a state. Here the basic strong function works as an infinite loop, taking and processing multiple inputs. Processed data is recorded as status information that another code can access. A strong function that implements a singleton pattern with a state is triggered only when it receives the appropriate input, and it pauses while it waits for additional triggers.
Connecting serverless in Azure Functions to the world
The initial release of the Azure functions for offline work was reasonable if you used to launch actions based on changes in Azure platform services. But when you use them to work with triggers from your own code and third-party code, as well as with external services and devices, you need a certain form of state and some idea of the workflow, because you will not control the delay of the response, It gets even more important when you wait for events from the Internet of things (IoT), when you do not know when these data will arrive.
Most of your code is probably a workflow code, automating interactions between routines and services. Strong functions allow you to process serverless code in the same way that sources, sources, and threads, as they occur, aggregate and link them as needed. They may not solve all your problems with distributed programming, but they contribute to reducing complexity and, possibly, even saving your money in cloud-based applications.
Azure Functions are no longer just in the cloud computing
Microsoft makes the portable Azure functions. The Azure battery life is available for your own containers, so you can create and deploy server applications on the internal network or in another public cloud. You do not get the benefits of Azure management tools, but it’s a useful way to ensure that your server code works anywhere. Azure Stack also supports the Azure functions for deploying hybrid clouds.
Initially, thought, you will not see long-lived functions while running Azure portable applications; Microsoft plans to support them later. At the moment, Azure services are required for long-term functions.
Serverless computing models, an effective workflow mechanism is necessary, and by considering strong functions as a programmable workflow, you get a tool that can help in creating more complex orchestrations. Used with other Azure services, such as Cosmos DB and Service Fabric, as well as with the recently improved Windows container services based on Kubernetes, this is the key to delivering distributed applications running through Azure. For a global cloud, these stateful functions will be irreplaceable.