Programming
We provide developers and engineers the guides and tutorials they...
Search
We provide developers and engineers the guides and tutorials they...
Content is king. It's not just about how you're going to write, b...
Looking for an engaging connection with thousands of other people...
What serverless computing means: functions as a service, pay-per-use, scaling to zero and cold starts, with the trade-offs, limits and good use cases.
Quick answer: "Serverless" does not mean there are no servers. It means you do not manage them. You upload code, usually as small functions, and the cloud provider runs it whenever an event occurs: an HTTP request, a file upload, a message in a queue, a timer. The provider handles provisioning, scaling, patching and availability. It scales automatically from zero to thousands of simultaneous executions, and you pay only for the time your code actually runs. The trade-offs are delays when a function starts from idle (cold starts), limits on running time and state, less control, and closer ties to one provider.
Also Read: Blue-Green vs Canary Deployments: Reducing Risk - Tooling
Each step hands more responsibility to the provider.
| Model | You manage | Provider manages |
|---|---|---|
| Your own servers | Everything | Nothing |
| Virtual machines | Operating system, runtime, scaling, your code | Hardware |
| Containers on an orchestrator | Images, cluster configuration, scaling rules | Hardware, perhaps the control plane |
| Platform as a service | Your application | Servers, runtime, some scaling |
| Serverless functions | Your functions | Everything else |
Serverless is the far end: you think about code and events, not machines.
Mike Roberts's article Serverless Architectures distinguishes two meanings.
Functions as a service (FaaS). You deploy individual functions that the platform runs on demand. Examples: AWS Lambda, Google Cloud Functions, Azure Functions, Cloudflare Workers.
Backend as a service. Fully managed services that you use through an API with no capacity to manage: object storage, managed databases, authentication, message queues.
A serverless application typically combines both: functions as glue between managed services. There are also serverless containers (such as Google Cloud Run and AWS Fargate), which run a container image on the same pay-per-use, scale-to-zero basis.
Using AWS Lambda as the model:
def handler(event, context):
name = event.get("queryStringParameters", {}).get("name", "world")
return {"statusCode": 200, "body": f"Hello, {name}!"}
Each environment handles one request at a time on most platforms. If a hundred events arrive together, the platform runs a hundred environments.
Common triggers:
| Trigger | Typical use |
|---|---|
| HTTP request | APIs and webhooks |
| File uploaded to storage | Resize an image, scan a document |
| Message on a queue or stream | Background processing; see how message queues work |
| Schedule | Nightly reports, clean-up jobs |
| Database change | Update a search index, send a notification |
For workloads that are spiky or quiet most of the time, the cost difference from always-on servers can be large.
When no warm environment is available, the platform must create one: start the sandbox, load the runtime, load your code, run its initialisation. That cold start adds delay, from tens of milliseconds to several seconds, depending on the language, package size and what the code does at start-up.
It matters for user-facing requests. Mitigations:
An environment may be destroyed at any moment, and consecutive requests may hit different ones. Nothing important can live in memory or on local disk. All state goes to external services: a database, a cache, object storage.
A burst of traffic creates many environments, each opening its own database connection. A traditional database can be overwhelmed by the sheer number. The usual answers are a connection proxy or a database designed for this pattern. See why your database needs connection pooling.
Also Read: How Git Works Internally: Objects, Commits and Refs
Pay-per-use is cheap when usage is low or uneven. For a service that is busy all day, every day, the per-request price can exceed the cost of running your own always-on containers or virtual machines.
Triggers, permissions, configuration and surrounding services are specific to each provider. The function code may be portable; the architecture around it usually is not.
A system made of dozens of functions and managed services is difficult to run locally and to trace. Good logging, metrics and tracing are essential.
| Good fit | Poor fit |
|---|---|
| Event-driven processing: uploads, queue messages | Long-running computations |
| Traffic that is spiky or unpredictable | Constant, heavy traffic |
| Scheduled jobs | Workloads needing very low, consistent latency |
| APIs with light to moderate traffic | Stateful, long-lived connections |
| Prototypes and small teams | Applications needing specialised hardware or system-level control |
| Glue between cloud services | Workloads that must be portable between providers |
They are not opposites, and many systems use both.
| Serverless functions | Containers on Kubernetes | |
|---|---|---|
| Unit | A function | A long-running service |
| Scaling | Automatic, per request, to zero | Configured; usually keeps a minimum running |
| Billing | Per invocation and duration | Per provisioned capacity |
| Start-up | Possible cold start | Already running |
| Control | Little | Extensive |
| Operational effort | Low | High |
See what Kubernetes does for the other side. Serverless container platforms sit in between: you supply any container, and it scales to zero.
A newer variation runs functions in data centres close to users, often on a CDN's network. See how CDNs work. These edge functions typically use lightweight isolates instead of containers, so they start almost instantly, with tighter limits on what the code can do.
No. Servers run your code, but the provider owns and operates them. You never provision or maintain one.
The extra delay when a function is invoked and no ready environment exists, so one must be created first.
For low, irregular or bursty traffic, usually yes. For constant high traffic, dedicated capacity is often cheaper.
Containers package an application to run as a continuously running service you manage. Serverless functions run on demand, scale automatically to zero, and are billed per use.
Serverless is an operating model, not an absence of hardware: you write functions, the provider runs them when events happen, and you pay for what you use. It removes a great deal of operational work and scales effortlessly. In return, you accept cold starts, stateless design, platform limits and dependence on your provider. Use it where traffic is uneven and the work is event-shaped.