Servers, containers, and serverless
Three levels of "how much of this do I want to be responsible for".
These three are not competing technologies so much as three points on one dial: how much of the machine you are personally responsible for.
- A machine
You rent a computer. You own the OS, updates, restarts, scaling. Total control, total responsibility. - A container
You ship your app plus its exact dependencies as one sealed unit. The host runs it. "Works on my machine" mostly dies here. - Serverless
You ship a function. Something else decides when to run it, how many copies to run, and when to throw them away.
That last clause is the practical rule. Serverless functions are disposable, so anything written to their local disk or held in a variable between requests can vanish without warning. State has to live somewhere designed to keep it: a database, a cache, object storage.
Serverless suits
- Traffic that is spiky or unpredictable
- Work that finishes quickly
- Not wanting to think about capacity
- Paying nothing when nobody visits
Serverless fights you when
- You need long-running processes
- You want to hold things in memory between requests
- You have steady, heavy, predictable load
- You need persistent connections to something
The names on the pricing pages
None of these three words is what any of it is called when you go to buy it. Vendors sell branded products, and a brand name does not announce which point on the dial it occupies. The mapping is short and worth having once.
- A machine is sold as an instance or a virtual machine: AWS EC2, Google Compute Engine, Azure Virtual Machines, a DigitalOcean droplet, a rented box from Hetzner.
- A container is normally built with Docker, then handed to something that agrees to run containers for you: Kubernetes, AWS ECS and Fargate, Google Cloud Run, Fly.io.
- Serverless is sold as functions: AWS Lambda, Azure Functions, Google Cloud Functions, Cloudflare Workers, and the functions built into Vercel and Netlify.
What to remember
- The three options differ in how much of the machine you own.
- Containers exist to make environments reproducible.
- Serverless instances are disposable, so state must live elsewhere.
Terms in this lesson
Show field notes toggles a search param the loader reads. With it off, the slow promise is never created, so nothing streams.