Function as a service (FaaS), sometimes simply referred to as serverless computing, focuses on event-driven triggers where code runs in response to events or requests. Serverless is gaining popularity with developers due to the simplicity and cost savings it provides.
Developers using FaaS have access to a platform that allows them to execute the code for their applications, giving them the ability to focus solely on coding and development for their application, without having to worry about maintaining a server. Since the code only runs in response to events or requests, developers save costs by only being charged for what they use.
Serverless computing also gives developers the opportunity to auto-scale horizontally without capacity planning or ongoing maintenance and allows for faster time to market due to the ease of development and testing for functions.
Top use cases for serverless
FaaS shines when used for simple and repetitive functions without consistent workloads or high volumes of requests. FaaS can be used in a variety of ways, from web apps and talking to APIs and online chatbots to customizing a website’s UI with A/B tests and geolocation, and more. A few of the most popular use cases for FaaS are APIs for web and mobile applications, multimedia processing, data processing, and the Internet of Things (IoT).
APIs for web and mobile applications
FaaS is a great option for event-driven applications like RESTful. Often, developers want to incorporate serverless components into their existing applications. For example, by using a FaaS offering, a Jamstack developer seeking to add a new API to their website or app can write simple functions that are triggered by certain events.
Websites we interact with every day likely use functions to manage event-driven processes. Sites that load dynamic content frequently use functions to call an API and then populate the appropriate information. Often, websites that require user input, like an address for shipping, use functions to make an API call to perform the backend verification needed to validate that the information—in this example, the address—input by the customer is correct.
While containers can also perform these tasks, functions shine when there are high amounts of fluctuating traffic. Serverless APIs are easy to build and maintain and are able to easily scale to meet demand. Since they only run when they are triggered, they can be extremely cost-effective to use for a component that doesn’t need state. During peak seasons or times when the website traffic is high and workloads drastically increase, functions easily auto-scale, providing a better customer experience while saving time and headaches for developers.
Multimedia and data processing
FaaS is frequently used to store or process user inputs, such as multimedia processing or other types of data. One example is using FaaS to execute certain processes based on the type of media a user uploads. Creating one function that triggers the appropriate response to a media upload saves developers time—and ultimately money.
The straightforward nature of FaaS also allows for easy intake and processing of large amounts of data, meaning that robust data pipelines can be built with little to no maintenance of infrastructure. Developers building a CRM or CMS tool can use functions to store the information in a database or connect with an API to store the data in an outside database. Because developers only have to write a single function, they can save significant time using FaaS for different processing components. Using FaaS for data processing can also save significant costs since developers are only charged when the events are triggered.
Internet of Things
The Internet of Things refers to devices now common in our homes that connect to the internet to perform functions. These devices are increasingly using FaaS to execute their tasks, only sending and receiving data when triggered by an event. This saves money for businesses since they don’t have to pay for computing power they aren’t using. Since FaaS allows for easy and automatic scaling, developers don’t need to worry about unpredictable usage patterns as consumers tap into smart home devices.