Jump to

What is serverless computing?

Serverless computing is a cloud computing execution model that allocates machine resources on an as-used basis. Under a serverless model, developers can build and run applications without having to manage any servers and pay only for the exact amount of resources used. Instead, the cloud service provider is responsible for provisioning, managing, and scaling the cloud infrastructure that runs the application code.

While the name can be misleading, serverless does not mean “no servers.” Instead, serverless apps abstract away the routine infrastructure work associated with application development. You have no visibility into the machines that run your applications, can’t configure them, and don’t have to manage or scale them. In other words, you pay for the service of a server, not the server itself. 

From the development perspective, it’s as if there are no servers at all—developers write the code, deploy it to production, and the cloud provider handles the rest.

How does serverless computing work?

When it comes to building applications, developers normally have a host of other server management tasks they need to carry out in order to deploy their code, such as defining resources for processing and storage, patching, load balancing, and more. All of these extra items lead to longer provisioning times and additional operational overhead that ultimately slows down development teams. 

Serverless computing attempts to provide an invisible “serverless” experience for developers, eliminating the need to think about servers or anything an application might need to run. Instead, the service provider does all the work behind the scenes to ensure you have the resources to execute your code and meet requirements without being charged for idle capacity. 

Here’s a simple analogy to make it easier to understand how serverless computing works

Think of serverless like getting water to your home. You could dig your own well, test the water quality, and install and maintain all the external plumbing needed to run it into the house. Or, you can connect to your city’s main water supply. You just turn the water tap and get as much water as you want exactly when you need it, and the city sends you a monthly bill for the exact amount of water you consume. 

Similarly, cloud providers automatically spin up the infrastructure resources and runtime environments needed to execute your serverless apps and automatically scale back down to zero when the execution is complete. Typically, you are charged based on the resources during the execution time. However, this can vary depending on the service and the vendor. 

Serverless vs. other types of cloud computing

But wait, don’t other types of cloud computing provide on-demand resources on a pay-as-you-go basis? It’s true that cloud service models like Infrastructure as a Service (IaaS) and Platform as a Service (PaaS) also provide on-demand access to computing resources. 

However, the cloud infrastructure allocated to you remains active even if you’re not using it. It’s also your responsibility to scale server capacity or configure your applications to scale up or down in response to user demand. 

Serverless architectures, on the other hand, are event-driven. Under this model, the provider only gives you resources when an event triggers your code to run and will scale instantly and automatically to requests.

Serverless computing examples and use cases

Within serverless cloud computing, there are generally two types of services: Function as a Service (FaaS) and Backend as a Service (BaaS). 

FaaS provides the computing resources needed to execute application logic in response to requests. These pieces of logic (or functions) are run in containers that are fully managed by the cloud service provider. Serverless applications are typically broken into single functions that perform one action in response to an event. 

BaaS delivers the entire backend functionality of web or mobile applications as a service, such as authentication services, database management, cloud storage, push notifications, and hosting. BaaS also removes the need to manage servers, containers, or virtual machines. 

Within development, the term “serverless” is usually used to describe FaaS offerings. However, it’s important to note that FaaS is technically a subset of serverless technology. Serverless computing includes any type of service where the server management, configuration, scaling, and billing are abstracted from the end user. This can include databases, storage, event streaming, messaging, and API gateways. 

In general, serverless computing is still primarily used for simple, short-lived tasks. Some of the most common serverless computing examples include: 

  • Integrating with third-party services and APIs
  • Running scheduled tasks (for example, daily reports, backups, or business logic) 
  • IT process automation like removing access automatically, initiating compliance security checks, or sending approvals
  • Real-time data processing for structured and unstructured data 
  • Automating continuous integration and continuous delivery (CI/CD) pipelines
  • REST API backends
  • Trigger-based actions or running scheduled tasks (for example, daily reports, backups, or business logic)
  • Asynchronous processing
  • Real-time or scheduled notifications

Advantages of serverless computing

Better developer productivity

Serverless-empowered developers focus on writing code and optimizing business logic instead of worrying about provisioning, managing, or scaling infrastructure. 

Out-of-box scalability

Serverless architectures scale up or down inherently. Unlike autoscaling in other types of cloud computing, which requires fine-tuning rules, serverless autoscaling is instant and can scale down to zero. 

Flexible pricing

Serverless pricing models are often charged based on actual usage and the time it takes to execute a function. You also don’t pay for idle capacity, helping to lower operational costs associated with running and managing your own servers.

Faster deployment

With serverless, DevOps teams don’t have to spend time on defining any of the infrastructure needed for integration, testing, delivering, or deploying code. They simply write and deploy into production.

Use any language

Serverless environments support any language or framework, allowing teams to develop in the language or with the framework—Go, Python, Java, Node.js, .NET, and more—they are most comfortable.

Disadvantages of serverless computing

One of the biggest disadvantages of serverless computing is that it is still a relatively new technology. As a result, it is not yet suitable to meet all potential use cases. 

In addition, the intentionally ephemeral nature of serverless and its ability to scale down to zero make it unsuitable for certain types of applications. It’s not built to execute code for long periods and cannot always serve applications with strict low-latency requirements, such as financial services applications. 

Last but not least, the advantages of handing over the management of all computing resources to a third-party provider can also come with several downsides. While it frees up time to focus on code, it can also be tricky to migrate to a new cloud provider. You also have no visibility into where or how your service is run and have limited control over how you scale, what type of hardware code runs on, and disaster recovery situations. 

Still, there’s a lot to like when it comes to serverless computing, especially for organizations that are looking to help empower developers to move faster and looking for a simpler, more cost-effective way to build cloud-based applications. 

It’s also clear that some of the current weaknesses that exist will be solved over time as serverless computing continues to evolve. In particular, a lot of work is already being done on open source implementations of serverless and finding ways to make cloud services more open to make solutions portable across different platforms and environments. 

Solve your business challenges with Google Cloud

New customers get $300 in free credits to spend on Google Cloud.
Contact us
Talk to a Google Cloud sales specialist to discuss your unique challenge in more detail.
Contact us