Serverless (Cloud) Computing - The new era of programming (FaaS): A case study with MS Azure Functions
Problem Statement
"It was working on my computer, I don't know why it is not working on the server". As for build engineers, we know the meaning of the above statement. It can be from simple reference mismatch to datatype error, a whole lot of things to go through. Even though everything goes through as expected till User Acceptance Testing, during Production day, again there comes the pain again.
The Answer is "Faas" also known as Serverless Computing
Function as a Service (FaaS) is a category in cloud computing where it allows the business to develop, build, run and manage applications (more precisely the functions) within cloud without worrying the complexities of building and maintaining the infrastructure as such.
In other words, it is a shift in the mindset of programming in contrast with traditional programming methodologies where the programmer develop, then test in the Local machine, then build, then move to different boxes (tests), then to production. Instead, create cross-functional independent functions which can perform the what a program is intended to do with the help of custom portal, where administrative tasks are outsourced/automated by an external vendor (In our case study: Microsoft).
Let us look at a simple real-world example, code snippets then its benefits as well.
If we refactor the above Web Server into different functions, our solution looks like below:
How to get the jumpstart to MS Azure Functions is not under the purview of this discussion. You can refer the same over here: https://docs.microsoft.com/en-us/azure/azure-functions/functions-best-practices
Once we are inside the MS Azure Function portal, we can start code, integrate, build and publish to the box seamlessly.
Let me show you a function for HTTP Trigger in our above example:
Function_example1.json - HTTP Trigger
{
"type" : "httpTrigger",
"direction": "in",
"webHookType": "genericJson",
"name": "req",
"methods": [ "post" ],
"route": "new_order"
}
The same way we would be able to write a simple function for queue trigger as well with a function
Function_example.2.json - Queue Trigger
{
"name" : "shibinQueueItem",
"type" : "queueTrigger",
"direction": "in",
"queueName": "Shibin_Order",
"connection": "AzureWebStorage"
},
In this way, with the help of micro functions, we will be able to achieve what we want without much hassle. Since we do everything within the portal itself, we don't need to worry about references and other internal calls etc... everything is safe in Azure (Cloud). The rest is to test and move the code to production. Of course, there are various tools supported by Microsoft Azure for version control, deployment and other lifecycle management of the software.
Major Benefits:
Rapid and Simple Development
If you are in a Rapid Process Automation Team or API based RPA team, nowhere else look at, this is the right tool for you.
No more high power independent developer machines.
Since all the codes can be developed, compiled and run via portal itself, all you need is an active internet connection and decent configuration to support the browser.
Settings are configured within GUI
All the complicated settings and reference calls are either completely automated or just with a click of a button. With every single release MS Azure, it is becoming easier to the end customer.
Cost Effective Pricing
Pay what you use for. The concept is how many times a particular function is called, that is how the service provider is going to charge you. So you are in control the price you pay for.
No Servers to maintain
No Virtual Machine, In fact as a developer you are inside the developer kit (IDE) itself, so no need to worry about the platform which you are working as well. Your functions and applications are always in an up to date infrastructure maintained by a third party, in this case, Microsoft.