Serverless
In short
Serverless is a cloud model in which the provider runs your code on demand, manages all the servers, scales automatically, and bills only for actual use.
What is serverless computing?
Serverless computing lets you run code or use backend services without provisioning or maintaining servers yourself. There are still servers, of course, but the cloud provider manages them entirely, including operating system updates, capacity, and scaling, so you can focus on your application code.
The best-known form is functions as a service (FaaS), such as AWS Lambda, Azure Functions, Google Cloud Run functions, and Cloudflare Workers. You upload a function, and it runs in response to an event, like an HTTP request, a file upload, a queue message, or a schedule. The platform starts as many copies as needed, scales to zero when idle, and charges per request and execution time.
An analogy is taking a taxi instead of owning a car: you don't handle maintenance, parking, or insurance, and you pay only for the rides you take. Serverless also includes managed services such as serverless databases, storage, and message queues, which follow the same idea of paying per use with no servers to manage.
Serverless has trade-offs. A function that has not run recently may suffer a cold start, a short delay while the platform spins it up, and functions usually have time and memory limits that make them a poor fit for long-running jobs. Compared with containers, serverless gives you less control over the environment, but also far less operational work.
At a glance
Key takeaways
- Serverless does not mean no servers; it means you don't manage them.
- Code runs in response to events such as HTTP requests or file uploads.
- It scales automatically, including down to zero when idle.
- You pay per request and execution time, not for idle servers.
- Watch for cold starts, execution time limits, and vendor lock-in.
Example
// Runs only when an HTTP request arrives; no server to manage
export const handler = async (event) => {
const name = event.queryStringParameters?.name ?? "world";
return {
statusCode: 200,
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ message: `Hello, ${name}!` }),
};
};Readers ask
Does serverless mean there are no servers?
No. Servers still run your code, but the cloud provider manages them completely, so you never provision, patch, or scale them yourself.
What is a cold start in serverless?
A cold start is the extra delay when the platform has to start a new instance of your function because none is ready, ranging from tens of milliseconds to a few seconds depending on the runtime and platform. Frequently used functions stay warm and respond faster.
What is the difference between serverless and containers?
With containers, you package the whole environment and usually decide how and where it runs, often with Kubernetes. With serverless, you provide just the code, and the platform handles running it, scaling it, and billing per use.
See also
- ContainerDevOps & Cloud, p. 12A container is a lightweight, isolated package that bundles an application with its dependencies and runs it on the host's shared operating system kernel.
- DevOpsDevOps & Cloud, p. 14DevOps is a set of practices and a culture that brings software development and IT operations together to deliver software faster and more reliably.
- APIBackend & APIs, p. 2An API is a set of rules that lets one piece of software request data or actions from another in a predictable, documented way.
- MicroservicesSoftware Architecture, p. 27Microservices are an architectural style where an application is split into small, independently deployable services that communicate over a network.
- CDNDevOps & Cloud, p. 7A CDN is a network of servers spread around the world that stores copies of website content and delivers it to each user from the nearest location.
- KubernetesDevOps & Cloud, p. 32Kubernetes is an open-source system that automates deploying, scaling, and managing containerized applications across a cluster of machines.
- PaaSDevOps & Cloud, p. 40PaaS (platform as a service) is a cloud model where you deploy your code and the provider runs everything under it: servers, operating systems and scaling.
Spotted a mistake or something missing on this page?Suggest an edit