Nowadays, FaaS is the buzzword when discussing serverless cloud platforms.
Function as a Service (FaaS) has completely changed how organizations run their online businesses to their in-house applications. It is a group of services that make running code on the cloud absurdly simple without the need to deploy an actual or purchase an entire virtual computing infrastructure.
Through the serverless model, all the cloud platforms like Amazon Web Services, Microsoft Azure, and Google Cloud Platform (GCP) have democratized application development by significantly reducing the time and effort required to deploy sophisticated backend services.
The time when launching ideas required significant financial investment is long gone. With the serverless FaaS model, all you need is a workable concept, a group of talented programmers, and a user account on one of the leading serverless cloud platforms. With this configuration, you can quickly build your services on cloud infrastructure, scale them automatically, and serve millions of consumers worldwide.
Function as a Service (FaaS) vs. Traditional Cloud Service
Any application, whether an online shopping app or the newest mobile game, needs an infrastructure to run its thousands of lines of code.
This architecture may consist of a single internal server, a collection of servers, or a virtual cloud server. The management and security of this setup are expensive and require recurring talent and resources.
In addition to the setup and ongoing costs, these servers have additional expenses for being idle even when you are not using the games or other apps installed on them and have no workload.
Because of all these reasons, traditional infrastructure is very inefficient, making FaaS a preferred choice for serverless compute shoppers.
Because of all these reasons, traditional infrastructure is very inefficient, making FaaS a preferred choice for serverless compute shoppers. Function as a Service (FaaS) enables you to execute your code on a manageable pool of resources while only paying for the time these resources are used, as opposed to setting up a complicated traditional infrastructure consisting of servers, load balancers, etc.
Events trigger the execution of FaaS functions, which entails that they are event-driven. Despite this not always being the case, these functions are frequently transient, stateless, and limited in scope.
Serverless computing gives software developers more room to experiment by enabling them to deploy and run code without worrying about server capacity and available tools, making it their favorite choice.
The three serverless computing platforms with the most consumers are AWS Lambda, Google Cloud Functions, and Azure Functions.
But which cloud service provider ought you to pick?
You may choose the best serverless computing provider by carefully examining these three options. We will compare Google Cloud Functions, AWS Lamda, and Azure Functions to help you determine the best option and what these services could be able to offer.
How does pricing work in FaaS?
Cloud service providers charge for FaaS based on the number of requests and compute time for a Function. The number of requests is typically billed monthly for every million requests. The unit of billing for compute time is GB-Seconds, which represents the estimated lifetime of the serverless program and the amount of memory allocated. For the same duration, running in higher memory costs more than running in lower memory.
Depending on the use case, these cloud vendors may also charge some additional price for storage and data transfer.
Comparing the operational costs for Google Cloud Functions, AWS Lambda, and Azure Functions
All three serverless cloud vendors come with a monthly free quota; Costs are only applicable after exhausting the free quota. You can see from the below table that AWS and Azure charge the same and have an identical free offering, while Google Cloud Functions offers an additional 1 million free requests per month.
While Amazon Web Services and Microsoft Azure round computation time to the nearest 1ms increment while adding it to the overall cost of scaling, Google Cloud Platform rounds computation time to the nearest 100ms increment.
Comparing the features of Google Cloud Functions, AWS Lambda, and Azure Functions
Programming Language Support
We can use several programming languages to write serverless applications. But there is a difference in language support when it comes to all three FaaS providers. Unquestionably, these service providers flawlessly execute serverless functions written in Java and Python.
However, it is virtually possible to code serverless functions in any other programming language using the abstraction layer provided by AWS Lambda and Azure Functions.
AWS Lambda uses custom run times to run code written in a programming language that is not directly supported; these runtimes use binary files compiled for Amazon Linux to run the code.
Although the Azure Functions approach is more versatile, it is challenging for programmers to apply. Azure Functions uses custom handlers to interface with serverless functions programmed in other than supported languages. These specialized handlers depend on HTTP primitives to function.
Comparing Scalability, Concurrency and Cold Starts for Google Cloud Functions, AWS Lambda, and Azure Functions
In the earlier days, it was a common practice for developers to use FaaS for testing business ideas before moving on to a more sophisticated platform.
These days, it is common to see organizations employing Functions as a Service (FaaS) to run their full-scale application and serve clients globally.
To run global-scale applications on FaaS, we must first understand how cloud providers handle concurrency and scale workloads in response to changes in computing demand.
As discussed earlier, FaaS functions are event-driven, which means an instance of a FaaS function gets launched whenever we trigger an event and the request is processed. This instance keeps on running to handle new subsequent events, and if no new request comes up after a predetermined amount of time, it is then recycled.
The number of concurrently running functions at a given time is known as concurrency. For Example, A FaaS instance is already processing a request, and a concurrent event is received; to process the new request, another FaaS instance has to be spun up concurrently.
Amazon Web Services is the only cloud vendor offering highly customizable concurrency management, while Google Cloud Platform and Azure do not advertise such offerings.
Before each event, a FaaS platform must take some time to initialize an instance of a function. This startup latency is called Cold Start and can vary considerably depending on different factors. It can range from a few milliseconds to several seconds.
Cold start tends to affect Azure and GCP more when we compare it with AWS Lambda, as it provides a service offering known as Provisioned Concurrency to eliminate the cold start issue.
Comparing Configuration and Performance between Google Cloud Functions, AWS Lambda, and Azure Functions
Because not all serverless functions are programmed equally, different workloads may necessitate various configurations to achieve the best results.
The memory configurations offered by AWS Lambda range from 128 MB to 10240 MB. Azure Functions offers you two memory configurations based on different plans (128 MB — 1500 MB for the consumption plan and (128 MB — 14000 MB for the dedicated one), and Google Cloud Functions offers it in the range of 128 MB to 4096 MB (NOTE: 4096 MB is the maximum limit provided by GCP).
The amount of memory will need to be changed by how resource-intensive the code is. While the maximum memory configurations offered by cloud providers vary, CPU clock speed is automatically adjusted based on the memory selection. If there is not enough memory allocated, a function will take longer to complete, and if there is too much memory allocated, cloud vendors will charge you for the resources that are not in use.
Execution Time-out or Maximum Execution Time
Maximum execution time is the amount of time a function takes to complete a request; it can vary from a few seconds to a few hours based on how intensive a workload is. Most workloads take a few milliseconds, while intensive workloads like data analysis and machine learning require a few hours to complete.
Below is the execution time-out configuration offered by each cloud vendor:
- AWS Lambda: 15 minutes
- Azure Functions: Consumption plans offer 5 minutes, and dedicated premium plans offer 30 minutes
- Google Cloud Functions: 9 minutes
It is never a good idea to extend the execution time-out. Always consider the RAM when deciding on execution time-out.
Functions deployed on FaaS servers are stateless. In other words, these functions are unaware of the execution results of other parallel-running brothers. Even the same function can be invoked multiple times with no interference. Because of this stateless model, FaaS is very scalable and easy to set up.
But to build meaningful and complex applications, these FaaS functions must communicate with each other or must be able to perform complex tasks by taking the output from one function as an input for another function. To solve this issue, cloud vendors came up with independent orchestration services in the form of steps that can integrate with function workflows.
Below is the list of orchestration services offered by the cloud provider:
- Amazon Web Services — AWS Step Functions
- Azure — Durable Azure Functions
- GCP — GCP Workflows
HTTP Integration Support
While Azure and GCP offer a much simpler HTTP integration, AWS requires separate resource configuration and provisioning in addition to API integration (API service has independent charges).
Comparison of Hosting Plans
GCP only offers one universally applicable hosting plan, whereas Azure has a wide selection of hosting plans. AWS initially only offered one hosting plan, but with the introduction of Provisioned Concurrency, they have expanded their offerings and even given customers the option to estimate costs in advance using their AWS pricing calculator.
Inbound and Outbound Data Transfers
While AWS Lambda does not charge for data transfer within the same cloud region, it does charge additional fees if you have to transfer inbound or outbound data between different cloud regions and storage devices. On the other hand, Google Cloud Functions and Azure Functions allow you to move inbound data for free and only charge a fee for outbound data transfer between different cloud regions.
For serverless functions, AWS Lambda and Azure Functions do not charge a fee for registry storage. However, users of Google Cloud are required to store serverless functions in Google’s Container Registry (a paid service). Even though their functions fall under the definition of free usage, this is how users ultimately end up paying for their free trial plan.
We can deduce from the discussion above that the services offered by all three FaaS providers are remarkably similar. AWS Lambda is more developed and includes extra features like Provisioned Concurrency, but Azure Functions and Google Cloud appear to be more affordable serverless solutions.
Serverless technology is genuinely revolutionary and will only grow in popularity. Comparing these three FaaS services will likely involve taking into account additional factors. Connect with our team of serverless technology experts at AnAr Solutions to modernize your current application or for launching a new business idea using serverless.