In most of our previous articles, we have learnt the following different Azure COMPUTE options that could be used for hosting different type of Web Applications like Websites, Web APIs etc.
- App Services – This is a PAAS (Platform as a Service) service where developers need not worry much about maintaining and upgrading the software and security patches of the Virtual Machines. Microsoft would take care of such details. As a developer, we just need to focus on the application code and business requirements. Please go through the Azure App Service: Create Web App from Visual Studio article to learn more about Azure App Services.
- Cloud Services – Cloud Services in another PAAS services where developers (or IT guys) needs to take care of provisioning the VM instances. Microsoft is responsible for Software upgrades and security patches etc. Please go through the Azure Cloud Services – Introduction to learn more about Cloud services.
- Virtual Machines – Virtual Machines are IAAS (Infrastructure as a Service) service from Microsoft where developers (or It guys) are completely responsible for everything, right from provisioning to maintenance of the Software and any other upgrades
- Web Jobs – Web Jobs could be used for hosting the background jobs related to any application. The Web jobs runs in the context of App Service Plan. If you host the App Services and Web Jobs in a same App Service Plan, then both the Web App and the Web Hob would share the resources of the App Service plan.
All the above options provide great services for different requirements. In this article, we will learn about another Azure COMPUTE option named Azure Functions.
Before discussing much about Azure Functions, lets briefly discuss about the few of the pain points of the above Azure Compute options when we plan to host components (Web APIs, background jobs etc.) in them.
- In most of the above Azure Compute Options, (if we use any of them for our production needs where at least one instance should be running all the time) we will end up paying for at least one VM that gets provisioned for our requirements irrespective of whether we use it or not.
- We need to either manually or auto-scale the infra based on the traffic that our applications get.
- For most of the above Compute options, developer need to develop the complete codebase including the plumbing code of accessing the Azure Services like Blobs, databases etc.
Introduction to Serverless Computing and Azure Functions
The name “Serverless” might be a bit confusing. People might think that there would be no servers that host the Azure Functions. Of Course, there are servers (Virtual Machine instances) that are responsible for hosting the Azure Functions and will scale automatically based on the traffic that the Azure Function would receive.
As a developer, you don’t need to worry about patching and upgrading the Operating Systems, .net Frameworks etc.
You don’t even need to worry about scaling (or even auto-scaling for that matter) the instances (you would have to do in case of all other Azure Compute options). Scaling is abstracted from you in case of Azure Functions.
Benefits of Azure Functions
Below are few of the benefits that one would get using Azure Functions.
- Quick development and deployment of small components to Azure Functions. As a developer, you don’t need to write the boiler plate code related to using the Azure services.
- You can directly code your functions right from your Azure Management Portal.
- You pay only for the execution minutes of your applications.
Azure Functions Pricing Model
As discussed earlier, you only pay for the execution minutes by using the “Consumption Plan”. Below are the two different pricing models that Azure Function supports.
- Consumption plan – This plan is based on the Executions and resource consumption. It also has a free monthly free of 1 million requests and 4,00,000 GB-s (Gigabyte seconds) of resource consumption per month. For more information about the calculations, please refer Functions Pricing. In most of the cases, you would choose this plan to make sure that your bill is low.App Service Plan – Regular plan which would be billed based on the pricing tier that you have chosen for your applications. Please refer to the Features of the Azure App Service Plan for more details about the features. You would choose this only in the case where you already have few applications that you might think that the same App Service plan is suffice even for hosting the Azure Functions.
We have learnt the following
- Different Azure COMPUTE Options that are available.
- Brief introduction of Serverless computing
- Advantages of Azure functions
- Azure Functions hosting and Pricing plans.