Serverless computing lets you run code without managing any server. You upload a function, the platform runs it when a request or event arrives, and you pay only for the time it runs. Servers still exist, of course; you just never see them.
Before you start
- Background on cloud models: IaaS vs PaaS vs SaaS.
How serverless works
- You write a function in a supported language and define a trigger: an HTTP route, a queue message, a file upload or a schedule.
- When the trigger fires, the platform starts an isolated environment (often a container or microVM), runs your function and returns the result.
- Idle functions scale to zero; busy ones scale out automatically to many copies.
Cold starts
If no warm instance exists, the platform must start one, adding latency from tens of milliseconds to seconds depending on runtime and package size. Small dependencies, lightweight runtimes and provisioned or kept-warm instances reduce it.
Pricing model
- Charged per request and per unit of compute time (memory × duration).
- Very cheap at low or spiky traffic, often within free tiers.
- At steady high traffic, a VPS or container platform is usually cheaper.
- Watch extra costs: API gateways, data transfer, managed databases.
Good use cases
- Webhooks and lightweight APIs.
- Image or file processing when something is uploaded.
- Scheduled jobs and automation.
- Event pipelines and chatbots with unpredictable traffic.
Limits
- Maximum run time and memory per invocation.
- Stateless: keep data in a database or object storage, not on local disk.
- Long-lived connections (WebSockets, background workers) need special services.
- Vendor lock-in through platform-specific triggers and APIs.
Serverless vs VPS
| Serverless | VPS | |
|---|---|---|
| Server management | None | You manage the OS |
| Scaling | Automatic, to zero | Manual or scripted |
| Cost at steady load | Can be high | Predictable, usually lower |
| Run time limits | Yes | No |
| Software freedom | Supported runtimes | Anything |
For a typical website, managed hosting or a VPS stays simpler. See how a VPS works.
Frequently asked questions
Is serverless the same as PaaS?
It is a form of PaaS focused on individual functions and per-request billing.
Can I self-host serverless?
Yes, open-source platforms such as OpenFaaS or Knative run functions on your own servers or Kubernetes cluster.
Can WordPress run serverless?
Not practically; it expects a persistent PHP server and filesystem. Use WordPress hosting instead.
