If you’ve come across the cloud computing term “FaaS,” you might be confused about its meaning. Function as a Service (FaaS) is a cloud computing service model designed for light, short-running workloads — usually smaller code units. It is typically used in microservices architecture, and its processes are often event-driven.
While FaaS shares some similarity with Platform as a Service (PaaS) — one of the three main cloud delivery models — FaaS is markedly different from PaaS. Read on to learn about FaaS, how it works, how it differs from PaaS and other models, and its use cases.
What Is FaaS (Function as a Service)?
FaaS is a service delivery model that allows users to run small code units without having to manage the underlying cloud infrastructure. It is often described as a serverless service — not because it doesn’t run on servers, but because you do not have to manage or interface with the infrastructure that runs the code.
Typically, codes run on FaaS tools under certain conditions or during certain events. However, the codes do not stay running for long periods, as FaaS solutions usually have a limited execution time.
How Does FaaS Work?
FaaS works by executing a code unit that performs a given function, such as image processing or alerting. You write the code (usually called a function) and deploy it on a FaaS tool. Then, when there’s an event that triggers the code, the FaaS tool executes it.
Generally, when you use a FaaS solution, the provider charges for only the resources used during execution. Therefore, you do not incur any charges while your code is inactive. In addition, the execution time on FaaS products is usually capped, so functions with shorter execution times are more likely to incur fewer charges.
In FaaS, you bring your code block to a provider-managed platform that executes it.
FaaS Examples
Examples of FaaS include public cloud services like AWS Lambda, Google Cloud Run Functions, Azure Functions, DigitalOcean Functions and OpenFaaS.
Here’s a brief overview of each one:
- AWS Lambda: Amazon Web Services (AWS) owns AWS Lambda. AWS Lambda executes functions of up to 900 seconds, and offers memory and ephemeral storage of up to 10240 MB.
- Cloud Run Functions: Cloud Run Functions (also known as Google Cloud Functions) is part of Google Cloud. It offers autoscaling and responds to events from various sources.
- Azure Functions: Azure Functions is a FaaS tool from Microsoft Azure. It offers 1 million free executions on its Consumption plan and 250,000 free executions on its Flex Consumption plan.
- DigitalOcean Functions: DigitalOcean Functions is a DigitalOcean product. It offers various runtimes and supports languages like Python, PHP and Node.js.
- OpenFaaS: OpenFaaS is an open-source FaaS tool provided by OpenFaaS Ltd. It is designed to simplify the deployment of functions to Kubernetes.
AWS Lambda, Azure Functions and Google Functions lead the global FaaS market.
Advantages of FaaS
The advantages of FaaS include cost-efficiency, scalability, faster development, increased focus on software development and flexibility.
- Cost-efficiency: FaaS solutions charge for only resources used during execution. Therefore, you are not charged while your function is inactive, unlike models like Infrastructure as a Service (IaaS), where you are charged for renting the infrastructure even when your code isn’t running.
- Scalability: FaaS products come with built-in scaling and scale automatically. For this reason, you rarely have to worry about performance issues due to resource limitations.
- Faster development: With the responsibility of provisioning and managing servers out of the way, software developers can work delivering software more quickly.
- Increased focus on software development: Without the need to manage infrastructure, developers can focus more on software development, enhancing the quality of their work.
- Flexibility: You can readily migrate your functions across FaaS solutions on different platforms.
Challenges of FaaS
The challenges of FaaS include limited control, cold start latency, limited debugging, complex testing and statelessness.
- Limited control: As with most cloud delivery models other than IaaS, FaaS offers limited control of the underlying infrastructure.
- Cold start latency: If your function hasn’t been executed for a while, you may see some delay when it is finally triggered again.
- Limited debugging: Due to the limited visibility of the underlying platform, all you can do is work on debugging your code when trying to resolve issues.
- Complex testing: Testing your function before using it in production can be complex, as its interactions in the testing environment will differ from its interactions in production.
- Statelessness: In most cases, FaaS is stateless, so the data it generates does not persist after execution. If you need statefulness, you’ll have to integrate an external resource.
FaaS Use Cases
There are various FaaS use cases, including file processing, real-time analytics, APIs (application programming interfaces), alerting, task scheduling, website data streams, and extract, transform and load (ETL).
- You can use FaaS solutions for file processing such as image conversion, QR code generation, thumbnail creation and video editing.
- FaaS tools can receive data streams from sources like websites and IoT devices, and analyze received data in real time.
- You can write a function that executes tasks like backups based on a schedule and run the function with FaaS.
- You can use FaaS to send notifications when an event such as a server failure or a database change occurs.
- With FaaS, you can build APIs that perform functions like authentication, file processing and more.
FaaS vs Other Cloud Computing Models (IaaS, PaaS & SaaS)
FaaS offers better cost-effectiveness than IaaS because you are charged only when your function runs. However, IaaS offers more control over the underlying infrastructure, allowing you to customize the environment as needed.
FaaS is similar to PaaS in that they both allow you to focus more on software development. However, PaaS offers an environment to develop and deploy a complete application, while FaaS is limited to modular code blocks.
Software as a Service (SaaS) is a cloud service model that provides the final product to the end user, while FaaS offers a platform on which you can build SaaS. In SaaS, virtually everything is abstracted from the user, but in the FaaS model, you still have control over the code.
FaaS has a similar level of abstraction to PaaS but uses code blocks instead of applications
FaaS vs Serverless Computing
Serverless computing is an approach to cloud computing in which the cloud service provider manages the underlying infrastructure, allowing users to focus on usage. FaaS, which includes tools that execute functions on provider-managed resources, is a type of serverless computing.
Final Thoughts
FaaS runs functional code blocks on managed resources when triggered by specific events or conditions and is priced based on how long the code runs. If you want to run small, short-lived code units while optimizing costs, you should consider FaaS.
What’s the longest your functions have run on a FaaS solution? If you haven’t used FaaS before, which use case would you most likely use it for? If you have used FaaS solutions, which one provided the best performance? Let us know your thoughts by commenting below. Thank you for reading.
FAQ: FaaS Meaning & Definition
-
FaaS is a cloud computing delivery model where the provider offers an environment to run small code units that perform specific functions when triggered by an event.
-
An example of FaaS is AWS Lambda.
-
The primary difference between PaaS and FaaS is that PaaS offers an environment to deploy and run complete applications, while FaaS offers an environment to execute modular codes for short periods.
-
The difference between FaaS and serverless is that FaaS is simply one type of serverless computing. In serverless computing, a cloud service provider manages the infrastructure so users can focus on usage.
-
XaaS (Everything as a Service) is a cloud delivery model that offers a vast array of cloud computing services, including IaaS, PaaS and FaaS.