How to Harness the Power of Serverless with Azure in 2020
28 Jan 2020
When speaking of the latest leading-edge tech trends, we have to admit that cloud computing is definitely on the TOP 10 list. Thanks to the excellent processing power of cloud-based services and platforms, small and mid-size companies, as well as large-scale corporations, can enjoy competitive benefits. To begin with, here’s a quick glimpse at some of the advantageous features provided by Serverless:
Flexibility of services;
Faster deployment times;
Accelerated workloads in the cloud;
Reduced costs on infrastructure management and maintenance;
Automated workflows, and so on.
What Serverless Technology is: A definition and its main providers
Since progress doesn’t stand still, we can count on more tech solutions to come out all the time. Giving the advent of cloud computing, you’ve likely heard of a new buzzword in town – Serverless computing. Despite the name, the serverless architecture still requires servers to host all applications and perform computing processes.
The key difference with the traditional cloud-based infrastructure is that a third-party vendor provides a backend platform and manages servers on his own entirely. Hence, developers can focus on other vital business goals and deliver improved services and products, ending up with streamlined customer experience, and the company’s optimized resources. It’s no wonder why the global serverless market is forecast to reach $7.7 billion by 2021.
In other words, serverless computing is a model, which provides developers with multi-functioning tools, allowing to create top-notch apps more effectively, since a third-party vendor manages the entire underlying infrastructure. A bunch of developers finds this kind of architecture scalable and flexible, as it is based on a fast TTM business approach.
Business adoption of emerging cloud trends in the United States and Europe as of 2019. Source
There are three ground-breaking providers in that sector – AWS Lambda, Azure Functions Serverless, and Google Functions. In this article, we want to have a closer look at Azure Functions and highlight the most significant benefits and pain points of such a popular platform.
How to build Serverless infrastructure in Azure Functions
Azure Functions is a powerful serverless cloud platform, based on an Event-Driven Architecture (EDA), allowing you to run code on-demand, with a service vendor taking care of the whole infrastructure and backend system.
There are specific events called triggers that bound to a function and cause it to run. A trigger defines how a function is invoked, and a function must have precisely one trigger. Triggers have associated data, which is often provided as the payload of the function. Binding to a function is a way of declaratively connecting another resource to the function; bindings may be attached as input bindings, output bindings, or both. The bindings provide data to the function as parameters.
With a Function-as-a-Service (or FaaS) platform on board, such as Azure Serverless Functions, you have a pay-as-you-go payment plan, meaning pricing is based on the number of executions, or utilized resources like RAM, CPU, Network. Thus, you are charged only when your code is running, excluding any need in a pre-purchased compute capacity.
Azure Functions Hosting Plans
To optimize the pricing terms depending on your tasks and needs, you can come up with the three hosting plans as follows:
1. Consumption Plan
Consumption plan provides the following features:
Consumption Plan is the default hosting plan, where a function execution times out after a configurable period;
Instances of the Azure Functions host are dynamically added and removed based on the number of incoming events;
Pricing is based on the number of executions, execution time, and memory used. Hence, you have to pay only when your functions are running;
The application scales out automatically, including the high load periods.
2. Premium Plan
Premium plan provides the following features:
The premium plan is designed for enterprise workloads with custom instance size up to 14 Gb of RAM
Perpetually warm instances to avoid any cold start;
Unlimited execution duration;
Premium instance sizes (one core, two core, and four core instances);
More predictable pricing;
High-density app allocation for plans with multiple function apps;
Instances of the Azure Functions host are added and removed based on the number of incoming events just like the Consumption plan;
Pricing is based on the number of core seconds, execution time, and memory used across needed and reserved instances. At least one instance must be warm at all times.
3. App Service Plan
App Service Plan provides the following features:
Function apps can also run on the same dedicated VMs as other App Service apps;
With an App Service Plan, you can manually scale out by adding more VM instances. You can also enable auto-scale;
Consider to stick with the App Service plan in case you have existing, underutilized VMs that are already running other App Service instances, or you want to provide a custom image on which to run your functions.
For additional info, you can use the table below:
Azure: Pros & cons you need to know about
Despite remarkable benefits, especially those Azure can offer to companies, having a small number of functions that needed to be hosted, some businesses may find a traditional architecture a better option. Let’s find out what features and pitfalls you can come up with, once you have Azure Serverless Functions on your board.
14 tools can be integrated with Azure Functions;
Reduced Pricing. You are no longer have to make advance payments and opt for computing capacity. The pricing model of Serverless Azure is event-driven: developers are only charged for what they utilize. The code runs when needed only, as well as automatically scales up when required;
No Infrastructure to Maintain. Servers and the whole infrastructure is managed and maintained by cloud services providers. Such an architecture is also aimed at reducing expenses, spent on investments in DevOps;
Enhanced Scalability. A serverless computing platform will automatically scale, once a user base or the number of executions start to grow. In case some function runs more often than others, the vendor’s servers can start up such a function way faster, using containers or the so-called warm-up run. Hence, an application, based on serverless architecture, can handle a colossal number of requests;
Boosted Deployments and Updates. Since an Azure-driven application is comprised of multiple individual and autonomous elements, hosted by a vendor, the updating, fixing, and patching processes can be performed in no time. Thanks to the application structure, there’s no need to release a big update for the entire application. Instead, a developer can upgrade a specific function only. To release a working app prototype, it’s not necessary to upload the code to servers, and developers don’t have to wait for OPS, DBA, etc.;
Reduced Latency. Microsoft is one of the largest corporations in the world, with representative offices and servers all around the globe. With that said, the code of serverless apps can run as close to the end-users as possible. With such cloud-based computing implemented into a business ecosystem, the requests travel the shortest distances between an end-user and on-promise server, thus reducing latency;
Testing, Monitoring, and Debugging. The lack of backend side visibility and the type of serverless application structure makes it quite a challenge for developers to test, monitor, and debug their software solutions. Azure Functions is an end-to-end platform with integrated tools and built-in DevOps capabilities, helping out to perform tests, monitor processes, and debug errors;
Networking. The serverless functions cannot be accessed through the standard IP. To do that, you have to set up a private API Gateway;
Vendors Lock-In. When you build your application on a serverless platform, you let a cloud vendor control and manage the whole underlying infrastructure. What if the vendor will end up as bankrupt? To migrate to another provider, you will more likely have to re-write the entire code. With 14 tools available in Azure Serverless Functions, you have a robust tech stack and toolkits for migration;
Long-running processes. Shall you deploy an application with long-running processes in serverless architecture, you might end up with significant expenses. The real catch here is that providers of serverless-related software solutions charge developers, based on the number of executions, and the amount of time code is running. In case you have a complex application, serverless computing can still be profitable, but you’ll have to build your product, based on other methods.
For more information on Serverless with Azure check this presentation from Jeremy Likness.
With all that said, the developers focused on reducing the TTM factor, and building easy-to-use flexible solutions can enjoy the benefits and power of Azure Serverless Functions for sure. In case you need an application with a small number of functions to perform short-running tasks, serverless computing will be an excellent money-saving investment.
Once you decide to deploy an application based on Serverless Architecture, our team of in-house seasoned experts is ready to offer you a competitive solution. In case you have any related questions or issues, we can provide you with professional advice. Please, don’t hesitate to contact us anytime.
Whether you are creating a cloud-based or a hybrid solution, we have the technical expertise you need.
Valeriy is CEO of ByteAnt with over 15 years of experience in software development always focusing and embracing new technologies IoT and SaaS. Besides leading the ByteAnt, Valeriy is a public speaker on tech talks, events, and meetups; mentor and marathon runner.