Infrastructure and deployment
What is Serverless?
Definition
Serverless is a cloud model where you deploy code and the provider runs, scales and bills it per use — the servers still exist, you just never manage them.
Also known as: FaaS, Functions as a Service
Serverless in more detail
In the narrow sense, serverless means functions as a service: you upload a function, bind it to a trigger such as an HTTP request, a queue message or a scheduled time, and the platform creates an instance when the trigger fires and destroys it afterwards. Scaling from zero to thousands of concurrent executions is automatic, and an idle function costs nothing. In the broader sense it covers any managed service with the same economics — serverless databases, queues and object storage.
The constraints follow from that lifecycle. Each invocation should be stateless, because nothing survives reliably between calls; anything long-lived belongs in a database or object store. Execution time is capped, so batch work has to be split or handed to a different service. And an instance that has not run recently must be created before it can respond — the cold start — which adds tens to hundreds of milliseconds, more for heavyweight runtimes, and is why latency-sensitive endpoints use provisioned concurrency or a lighter runtime.
The economics invert the usual trade. Per-request billing is excellent for spiky, unpredictable or low-volume workloads and can be markedly worse than a rented server for steady high traffic. Operational burden moves rather than vanishing: no patching or capacity planning, but harder local development, distributed tracing that matters more, and per-provider configuration that makes moving elsewhere real work.
Serverless example
// AWS Lambda handler behind an HTTP trigger
export const handler = async (event) => {
const id = event.pathParameters.id;
const order = await db.get(id); // state lives elsewhere
return {
statusCode: 200,
headers: { "content-type": "application/json" },
body: JSON.stringify(order),
};
};
Lifecycle
no traffic -> zero instances, zero cost
first request -> COLD START: instance created, code loaded
next requests -> warm instance reused, fast
traffic spike -> more instances, automatically
idle again -> instances reclaimed
Watch for: execution timeouts, per-invocation billing,
connection limits when hundreds of instances hit one database.Serverless — common questions
- Does serverless mean there are no servers?
- No — it means you never provision, patch or scale them. The provider runs the machines; your unit of deployment is a function or a managed service, and your unit of billing is usage rather than uptime.
- What is a cold start?
- The extra latency when a request arrives and no warm instance exists, so the platform must create one and initialise your runtime and dependencies. It typically adds tens to hundreds of milliseconds and is worst for large bundles and heavy frameworks.
- Is serverless cheaper?
- For spiky, bursty or low-volume workloads, usually yes, because idle time is free. For steady high-throughput traffic a reserved instance or container platform is often significantly cheaper per request.
Keep reading
Every definition in the set is indexed A-Z in the developer glossary, and the cheat sheets cover the syntax once you know what you are looking for.
Browse the A-Z glossary