Serverless computing: uses, advantages, and disadvantages

Updated: August 28, 2024 Time to read: ~

TL;DR

Serverless computing lets developers build and deploy applications without managing back-end server infrastructure — the cloud provider handles provisioning, scaling, and maintenance automatically. Costs are usage-based, making it a flexible and often economical choice. However, teams should weigh trade-offs around security, data privacy, vendor lock-in, and debugging complexity before adopting a serverless architecture.

Why is serverless computing so popular?

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. 

How do serverless functions work?

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. 

How does serverless scaling work?

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:

  1. Variable in price. Vendors charge you only for what you use. 
  2. Self-maintaining. Clients don't need to perform server maintenance. 
  3. Scalable. They scale up and down continuously with no client programming help. 
  4. 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 Backend as a Service (BaaS), Platform as a Service (PaaS), and Infrastructure as a Service (IaaS):

BaaSBackend as a ServiceAllows developers to outsource the administration of back-end functions. PaaSPlatform as a ServiceEnables you to develop and deploy products within the cloud environment. IaaSInfrastructure as a ServiceAllows 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. 

How is serverless computing evolving?

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.

What are the advantages and disadvantages of serverless computing?

Should you abandon your current setup and move to a serverless stack? Let's dig into the pros and cons. 

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).
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.
Flexibility: Serverless models scale without your intervention.
Privacy: Your resources are shared in cloud environments that could also be inhabited by others.
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.
Complexity: If something isn't working as it should, spotting the issue could be difficult. You'll have multiple spaces in which to look.
Speed: Developers don't need to waste time worrying about estimating and allocating server space.
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.

Frequently asked questions

Is serverless computing truly 'serverless'?

Not exactly. Cloud providers still use physical servers to run your code — the term 'serverless' means that you, as the developer or business, don't need to provision, manage, or maintain those servers. Some experts prefer the term Function as a Service (FaaS) to better reflect this reality.

How does pricing work in a serverless model?

Serverless computing uses a pay-per-use model, meaning you are only charged when your code is actually executing. Unlike some other cloud models where you reserve capacity regardless of usage, serverless fees scale up or down automatically based on demand.

How does serverless computing differ from Backend as a Service (BaaS), Platform as a Service (PaaS), and Infrastructure as a Service (IaaS)?

While Backend as a Service (BaaS), Platform as a Service (PaaS), and Infrastructure as a Service (IaaS) all offer cloud-based administration, the key differentiator for serverless computing is automatic scaling. With BaaS, PaaS, or IaaS, you typically need to coordinate with your vendor when you need more capacity — serverless handles this without any manual intervention.

What are the main security concerns with serverless computing?

Because serverless computing involves handing back-end data and processing to a third-party cloud provider, security and privacy are top concerns. Your resources may be shared in a multi-tenant cloud environment, and you rely on the vendor's security practices to protect your data. This is cited as the leading reason why some companies choose not to adopt serverless systems.

Why can debugging be harder in a serverless environment?

In a serverless architecture, your application is composed of many discrete, independently triggered functions spread across a cloud environment. When something goes wrong, identifying the source of the issue requires checking multiple distributed components, which can make troubleshooting more complex than in a traditional monolithic or server-based setup.

What is a serverless 'function' and how is it triggered?

In serverless computing, a 'function' is a discrete piece of code that sits dormant until a specific user action or event activates it. For example, when a user uploads a photo, a function might automatically trigger to resize and reformat that image. Once the event is complete, the function returns to a dormant state until it is needed again.

References

The following sources were consulted in the preparation of this article.

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.

Continue your Identity journey