The name is misleading: there are still servers. Serverless computing simply means you never see, size or maintain them. You give the cloud provider a small piece of code, tell it what event should run that code, and pay only for the time it actually runs. For the right kind of work this removes almost all server administration and can cost very little. For the wrong kind, it can be awkward and surprisingly expensive. This article explains the difference in business terms.
How serverless computing works
Traditional hosting is like renting a shop: you pay rent whether customers walk in or not. Serverless is closer to paying a market stall fee per sale. Here is the basic flow:
- A developer writes a function, a small unit of code that does one job, for example "resize an uploaded image" or "return a customer's order history".
- The function is connected to a trigger: an HTTP request, a file landing in storage, a message on a queue, a database change or a schedule.
- When the trigger fires, the platform starts the function, runs it, and shuts it down. If a thousand events arrive at once, it runs many copies in parallel.
- You are billed by the number of invocations and the compute time used, typically measured in milliseconds and memory allocated.
The best-known platforms are AWS Lambda, Azure Functions, Google Cloud Run functions (formerly Cloud Functions) and Cloudflare Workers. The term "serverless" is also used more broadly for any service where you do not manage capacity, such as serverless databases, queues and container platforms like Google Cloud Run or AWS Fargate.
A tiny example
This is a complete AWS Lambda function in Python that responds to an HTTP request. There is no web server to install, no operating system to patch:
import json
def handler(event, context):
name = (event.get("queryStringParameters") or {}).get("name", "there")
return {
"statusCode": 200,
"headers": {"Content-Type": "application/json"},
"body": json.dumps({"message": f"Hello, {name}"})
}
Connect it to an HTTP endpoint (through a function URL or API Gateway), and it can serve one request a month or thousands a second.
Where serverless shines
- Irregular or bursty workloads. A form handler, webhook receiver or report generator that is idle most of the time costs almost nothing when idle.
- Event processing. Resizing images on upload, processing CSV files, sending notifications when an order is placed.
- Scheduled tasks. Nightly clean-ups and data syncs that would otherwise need a server running all day to execute a five-minute job.
- Glue between services. Connecting a payment gateway webhook to your CRM, or your website forms to email.
- Small teams. No servers means no patching, no capacity planning and built-in high availability across zones.
Where it struggles
- Steady, high-volume traffic. Pay-per-execution pricing is great at low volume, but a service that is busy around the clock can cost more than reserved virtual machines or containers. Do the arithmetic with real numbers.
- Long-running jobs. Functions have maximum run times; AWS Lambda, for example, stops a function after 15 minutes. Video encoding or large data migrations may not fit.
- Cold starts. When a function has not run recently, the platform must start a fresh environment, adding a delay to the first request. For most business tasks it is unnoticeable; for latency-critical APIs it may need mitigation, such as provisioned concurrency, at extra cost.
- Stateful applications. Functions do not keep memory between invocations. Sessions, files and caches must live in external services such as a database, Redis or object storage.
- Database connections. Hundreds of parallel functions each opening a database connection can overwhelm a traditional database. Connection proxies or serverless-friendly databases solve this, but it needs planning.
- Lock-in and debugging. Triggers, permissions and deployment tooling are provider-specific, and tracing a problem across many small functions needs good logging.
Serverless vs a traditional server
| Serverless functions | VM or VPS | |
|---|---|---|
| Billing | Per invocation and execution time | Per hour or month, used or not |
| Scaling | Automatic, per request | Manual or via auto-scaling groups |
| Maintenance | Provider patches the runtime | You patch the OS and software |
| Execution limits | Time, memory and package size limits | None beyond the machine size |
| Best for | Event-driven, spiky or occasional work | Steady load, long processes, legacy apps |
Questions to ask before going serverless
- How many requests or events per month, and how are they distributed over the day?
- How long does each task take, and does any task exceed the platform's limits?
- Does the code need to keep state, files or long-lived connections?
- Does your team have experience with the provider's tooling, logging and permissions?
- How much would moving to another provider cost later?
Many good architectures are mixed: a conventional application on a server or container for the core, with serverless functions handling uploads, webhooks and scheduled jobs around it. If you are planning a new application and want to weigh the options, our web application development and cloud solutions pages describe how we approach these decisions.
Key takeaways
- Serverless computing runs your code on demand; you pay per execution and never manage servers.
- It is ideal for event-driven, bursty and scheduled work, and for teams without server administrators.
- Watch for execution time limits, cold starts, database connection handling and high-volume costs.
- A hybrid of conventional hosting plus serverless functions is often the most practical design.