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.
Serverless computing, despite its name, doesn't eliminate servers. Rather, it streamlines application development by abstracting away routine infrastructure tasks. This means you don't see, configure, manage, or scale the underlying machines running your applications. Essentially, you pay for the server's service, 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.
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.
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.
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.
Key definitions:
Serverless
PaaS
Containers
VMs
Within serverless cloud computing, there are generally two types of services: Function as a Service (FaaS) and Backend as a Service (BaaS).
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.
Some of the most common and emerging serverless computing examples include:
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
Serverless computing can help reduce the friction of infrastructure definition for DevOps teams when it comes to integration, testing, delivery, and deployment. They can then zero in on writing and deploying code straight to 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.
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.
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.
Start building on Google Cloud with $300 in free credits and 20+ always free products.