Serverless
A cloud model where you run code without managing servers — the provider handles scaling, capacity, and maintenance. You pay for actual usage, not idle. Examples: AWS Lambda, Vercel, Cloudflare Workers. Great for sporadic traffic and event-driven apps. Not for everything.
- Sporadic or variable traffic.
- Event-driven workloads.
- APIs and webhooks.
- Teams without DevOps.
- Constant high traffic (dedicated servers cheaper).
- Long-running processes.
- Stateful apps.
- When you need full control.
Definition
Serverless means the cloud provider manages servers; you deploy functions or apps that scale to zero. Pay-per-use (invocations, duration, requests). No capacity planning. Types: FaaS (Lambda, Workers) for functions, BaaS (Firestore, Supabase) for managed backends, serverless containers (Fargate).
Why it exists
Managing servers (provisioning, scaling, patching) is overhead. Serverless lets developers focus on code while the provider handles infrastructure, scaling to zero when idle.
How it works
Deploy code (function or app). The provider runs it on demand, scales automatically, and charges per use. No idle costs (scales to zero). Triggers: HTTP, events, schedules. Examples: Lambda (functions), Vercel (full-stack), Workers (edge), Fargate (containers).
Scaling limits
Cold starts (latency on first call). Execution time limits. Vendor lock-in (each provider's runtime/API). Hard to debug. Not cost-effective for constant high traffic. State management between calls.
Cost shape
Pay per use (requests, duration). Free tiers. Cheap for sporadic traffic, expensive for constant load. No idle costs.
Alternatives
- Containers (Docker/K8s) — More control, more management.
- VPS (DigitalOcean) — Predictable cost, you manage scaling.
Failure modes
- Cold starts.
- Vendor lock-in.
- Execution limits.
- Hard to debug.
- Unexpected costs at scale.