Serverless computing is the choice of the world, and Microsoft Azure Function makes this possible by delivering event-driven cloud computing & configuring application development with it.
But how exactly Azure does do this? What are the advantages of using it? What would be the azure function cost estimation? Know all your answers on this blog.
What is Microsoft Azure?
Microsoft Azure generally referred to as Azure, is an ever-expanding set of cloud computing services that help organizations match business challenges. It gives freedom to build, test, deploy, and manage applications using your favorite frameworks and tools via data centers managed by Microsoft.
A Brief on Microsoft Azure Functions
Azure Functions is a serverless computing service designed to simplify and accelerate application development. These functions offer the ability to run small codes, and functions in an extremely scalable, flexible & cost-effective manner.
Not to doubt, Azure combines the best world of web services and schedule software as it is ultimate in infrastructure abstraction. Also, it removes any concerns that are related to operating systems and underlying servers.
Azure Functions Pricing Details
The pricing of Azure functions depends upon the execution time and total executions. This includes a monthly free grant of one million requests & 4,00,000 GBs of resource consumption in a month.
- Execution Time: $0.000016/GB-s
- Total Executions: $0.20 per million executions
By buying, the Azure Premium plan, users can avail of enhanced performance. It is billed based on GB-s and vCPU-s.
- vCPU Duration – $0.173 vCPU/hour
- Memory Duration – $0.0123 GB/hour
Since Azure functions offer you cloud services, it comes up with a big list of advantages that are as follows –
- Pay as per your model– Azure Functions comes in the “Pay as you go model” which means users have to pay only for what they are using. The cost of the Azure function is based on the executions/month (mentioned above).
- Support different languages – The best part of the Azure function – it supports a variety of languages like Python, C#, Java, F#, and many more.
- Easily integrate with other Azure Services– Azure functions can also integrate with other services of Azure like Event Hubs, Azure Service Bus, Notification Hubs, Event Grids, and many more without any inconvenience.
- Trigger-based executions – Azure functions can easily be executed based on configuration triggers. This supports various triggers like Queue Trigger, Event Hub Trigger, HTTP triggers, and more. It runs on-demand as it’s a trigger-based service.
When to Use Azure Functions?
Azure functions are like logic applications that are “event-driven”. It means they run based on configured and associated events, or “triggers.” For instance, an Azure Function can be triggered by an event in DMS (document management system), running process once every 24 hours, or when a new document is uploaded to the SharePoint library.
Azure Functions also respond to Azure-specific events, such as notifications arriving in Message Queue, or the addition of an image to a Storage Blob.
Here are the typical scenarios where we make use of Azure Functions –
- SaaS event processing
- Azure service event processing
- Serverless mobile backends
- Timer-based processing
- Real-time bot messaging
- Real-time stream processing
- Serverless web application architectures
Azure Function cost Estimations
Two hosting models for functions are provided by Azure. The first one is named Consumption plan which is the canonical way of Function use. This plan offers the pay-per-use model. However, there are a few caveats associated with it –
- Functions running on the consumption plan have a time limitation of 5 minutes. It means those function that runs more than 5 minutes, the runtime may abruptly kill the function & data not persisted would be lost. Though you can extend the time to 10 minutes, yet by default 5 minutes is set.
- Limited Memory Usage – 1.5 GB which is shared among the functions that are present within the Function App.
- Scaling is automatically handled and based on the back pressure of triggers. The unit of scale is named as Function app. When the function app gets scaled, then additional instances were provisioned. Better understand with an example, if a function is triggered by a new message in the Azure Service Bus Queue, the runtime will monitor the age of the oldest message and the depth of the queue to check if there are additional instances that should be provisioned or not. For each trigger type, there is unique scaling.
- After idling for a period, functions “turn off” and it can also incur a startup cost in respect of performance. The performance penalty can be reduced.
The pricing model for the consumption plan is solely dependent upon use, not provisioning. The combination of GB-s and number of execution is the cost of function as mentioned in pricing details.
Here, the formula for calculating GB-s is
GB-s = (number of executions) x (execution duration in seconds) x (amount of RAM used in GB).
App Service Plan
App Service plan is the other hosting model where you can select the VM configuration to be provisioned. It’s the same plan, as Azure Web Apps that are being used for other PaaS offerings. The amount of RAM and the number of cores is static within the configuration, so choosing the correct configuration as the price would be directly affected.
Which Plan is good to pick?
Most users choose the consumption plan as it’s a default choice. However, you can also go with the App Service plan if-
- Your functions consume more than 1.5 GB of memory
- You already have an underused App Service plan that supports the Function app
- The startup performance penalty required to be eliminated
- Your Azure function needs to actively run for more than 10 minutes
- There is a need to configure network options for security or accessing to secure resources (like IP whitelisting or VNET integration)
The Bottom Line
Azure functions make application development simple and quick with its ultimate capabilities. Cloud computing improved things a bit, but there are many changes to be looked upon.
With Azure Functions serverless architecture, it’s quite possible to stop worrying about the infrastructure considerations that you faced previously.
Now, just focus on creating and uploading proper code. The highlight of Azure functions is – that you can write the code in easy-to-use web interfaces. Also, you can debug locally on your machine of choice. This also lets you leverage the same function code run on other targets like Azure Stack, IoT Edge, Cloud Service, and so on.
We hope you gathered enough information on Azure Functions. For more technical blogs, stay tuned with us!