Serverless Computing: Uses, Advantages, and Disadvantages
Serverless computing involves using cloud-based technology to handle back-end functions of a website or app. You define an event that triggers code, and the serverless platform takes over. Your fees scale up or down, depending on the frequency of use.
The word "serverless" is inaccurate in this model. Cloud providers do use servers to support their customers. But if you buy the technology, you won't invest in back-end servers as you develop or deploy a web-based application. And you won't maintain those back-end servers either.
Since serverless computing does involve servers, some experts prefer to use the term function as a service (FaaS) instead.
No matter what you choose to call it, serverless computing is popular. In a 2019 survey, for example, 40 percent of respondents worked for companies that used some type of serverless architecture. Most cited cost as a top benefit.
Let's dig deeper into what serverless computing is and how it works so you can see if your company should join in.
What is serverless computing?
Serverless computing allows developers to focus on the front end of a website or app without worrying about back-end functions at all.
The front-end of a website or application involves the bits that consumers see, interact with, and remember. Graphics, text, and other visual cues begin here.
The back-end of a website or app includes the pieces that users don't see, but they need these pieces for a smooth website experience. Those back-end pieces can include:
- Data files. Inventories of available products, locations of open stores, and lists of blog posts all need a home in the back-end.
- Processing. Everything a consumer does needs a bit of power, and most of the data crunching happens on the back end.
- Security. A user might need to log in to see specific parts and pieces. The login page is on the front, but the function happens in the back.
In the serverless model, these sorts of back-end functions are disparate pieces of code that sit dormant until users need them. When a user does something to trigger the code, the serverless computing vendor kicks in, allocates space, and allows for a seamless transition.
As an expert described the model in 2014, developers write application code and load it into the serverless computing environment. It stays there, sitting dormant until an event triggers the code. At that point, the serverless computing vendor takes over and executes the code in the cloud environment. When the event is over, the code goes dormant again.
These events are called "functions" in the serverless computing model. For example, a website might have a function that allows users to upload photos that are then resized and reformatted. As soon as a user uploads a photo, the function begins.
Since the serverless model relies on these functions that may or may not be running continuously, scaling is possible. If the website or app has a significant amount of traffic, the cloud can offer more space and processing power (for a fee). If the traffic slows, the space and fees diminish accordingly.
The serverless model can seem large and a bit squishy. But experts say true serverless applications have four attributes. They are:
- Variable in price. Vendors charge you only for what you use.
- Self-maintaining. Clients don't need to perform server maintenance.
- Scalable. They scale up and down continuously with no client programming help.
- Reliable. These products have built-in high availability and fault tolerance.
What makes serverless computing different?
You've probably read about cloud-based servers that tackle website or app administration. If some of the products you've read about seem eerily similar to serverless computing, you're not wrong.
Many cloud-based services share attributes with serverless computing, including:
- BaaS. Backend as a service (or BaaS) allows developers to outsource the administration of back-end functions.
- PaaS. Platform as a service (or PaaS) enables you to develop and deploy products within the cloud environment.
- IaaS. Infrastructure as a service (or IaaS) allows you to do almost everything involving a website or app within the cloud environment.
Automatic scaling sets serverless computing apart from all of these models. In most cases, you'll need to talk with your BaaS, PaaS, or IaaS vendor when you need more space. You won't need these conversations in the serverless computing model.
Serverless computing is also changing as the technology becomes more popular. For example, some companies are experimenting with distributed networks with nodes scattered far from central data centers. This arrangement reduces latency and offers a better experience for users. Other cloud-based models may not move in this direction.
Serverless computing advantages and disadvantages
Should you abandon your current setup and move to a serverless stack? Let's dig into the pros and cons.
Advantages of serverless computing include:
- Cost. You'll only pay for what you use. In some other cloud-based models, you'll reserve space (whether you use it or not).
- Flexibility. Serverless models scale without your intervention.
- Accuracy. Developers can focus on a specific function rather than worrying about the back-end architecture that supports that action. This separation of powers could allow for cleaner code.
- Speed. Developers don't need to waste time worrying about estimating and allocating server space.
Drawbacks of serverless computing include:
- Security. You'll hand part of your data to another company that may or may not protect it. Of the 60 percent of companies that don't adopt serverless systems, their leading concerns with the model are security and fear of the unknown.
- Privacy. Your resources are shared in cloud environments that could also be inhabited by others.
- Complexity. If something isn't working as it should, spotting the issue could be difficult. You'll have multiple spaces in which to look.
- Contracts. Some vendors lock their clients into long-term agreements.
Perhaps you'd like to break up your development process, but you're not ready to dive into serverless computing solutions. Consider microservices. We've written an in-depth blog post about these products that explains the pros and cons in detail. Check it out.
O'Reilly Serverless Survey 2019: Concerns, What Works, and What to Expect. (November 2019). O'Reilly.
Serverless Explainer: The Next Generation of Cloud Infrastructure. (April 2017). Networkworld.
What's Next for Serverless Architecture? (February 2020). InfoWorld.
What Serverless Computing Really Means, and Everything Else You Need to Know. (April 2019). ZD Net.
Aurora Serverless: The Good, the Bad, and the Scalable. (April 2020). Jeremy Daly.
Serverless Computing: 5 Things to Know About the Post-Container World. Tech Beacon.
Why Serverless Computing is the Fastest-Growing Cloud Services Segment. (September 2018). CB Insights.