LOAD-BEARINGfree
High-level designTier 10 · unit 1 of 6 · 13 min read

VM, container, serverless

Every box you have drawn so far runs somewhere, and this course has been carefully vague about where. Three answers dominate, and they are usually presented as a progression from old to new. They are not. They are three points on a curve trading control against operational surface, and each has a cost profile specific enough to decide with.

What each one actually is

  • Virtual machine — a whole machine image with its own kernel. Boots in tens of seconds to minutes. You own the operating system, its patching, and everything above it.
  • Container — a process with an isolated view of the filesystem and network, sharing the host's kernel. Starts in about a second. You own what is inside the image; the platform owns the host.
  • Serverless function — the platform owns everything up to your handler. Scales to zero, bills per invocation, and has no existence between requests.

The three costs that decide it

1. Cold start. Minutes for a VM, seconds for a container — plus the image pull, which people forget and which turns a two-gigabyte image on a fresh node into something much slower than "a second". Functions start in milliseconds to seconds depending on runtime and package size. But cold start only matters when it lands on a user's request, so the real question is your traffic shape, not the number.

2. What the process is allowed to hold. This is the decisive one and it is rarely stated plainly: serverless is bad at anything that wants to keep state between requests. Which turns out to be most of this course:

  • Connection pools — every instance opens its own, so Lesson 3.06's connection ceiling arrives hard and fast. This is the single most common serverless outage.
  • In-process caches — hit rate collapses across many short-lived instances (4.06), so the cache you were counting on mostly misses.
  • Long-lived connections — WebSockets from Lesson 1.04 need somewhere that persists.
  • Warm model weights — 11.01's minutes-long load, repeated per cold instance.

Those are not limitations to engineer around. They are a statement about which architectures fit.

3. Exit cost. Lesson 14.06's spectrum, made concrete. A VM image is portable. A container is the best portability story available — genuinely close to "runs anywhere". A function wired into one provider's event model, identity system and managed triggers sits at the expensive end, and the lock-in is in the glue rather than the code.

Where each one belongs

  • Serverless — spiky, stateless, short work with long idle stretches: webhooks, media processing, glue between services, scheduled jobs. Scale-to-zero is a real economic win when the alternative is a machine idling at 3am.
  • Containers — the default for services with steady traffic. You are paying for the capacity anyway, so you may as well let the process hold a pool, a cache and a connection.
  • VMs — when you need the kernel, specific hardware, a licence bound to a machine, or control of the disk for a stateful system.

And there is a cost inversion worth knowing before you commit: serverless is dramatically cheaper at low and spiky volume, and dramatically more expensive at steady high volume. The crossover is computable from your own numbers. Teams adopt at the cheap end, grow, and meet the crossover a year later as a budget surprise rather than an architecture decision.

The operational surface moves, it does not vanish

Serverless removes patching, capacity planning and instance management. It adds cold-start latency you do not control, per-function identity and permissions, distributed tracing across dozens of tiny units, execution limits (concurrency, duration, payload size) that become architectural constraints, and local development that does not resemble production.

That is Lesson 14.07's cognitive load, relocated rather than removed — and the honest way to evaluate a platform is to ask what it removes and what it adds, not to count what it removes.

The trap

"Serverless means no servers, so there is nothing to operate." The fastest way to take down a database is to put a function in front of it. Your compute now scales instantly to a thousand concurrent invocations; your datastore's connection limit did not move, and Lesson 3.06 explained exactly what happens next. Elastic compute in front of inelastic state is not a scaling architecture — it is an amplifier pointed at your most fragile component, and it works beautifully in testing.