Cloud Parts

VM, container, microVM or function?

DimensionVirtual machinesContainersMicroVMsServerless functions (FaaS)
You manageThe OS and everything above itYour image; the host OS is sharedA small kernel and root filesystem, or nothing on a platform built on themOnly the handler code
IsolationOwn kernel, hardware virtualisationShared host kernel; a kernel bug can cross the boundaryOwn kernel, hardware virtualisationWhatever the platform uses; Lambda uses microVMs
Start-up timeTens of seconds to minutesSeconds or lessAbout 125 ms to boot; less from a snapshotMilliseconds warm; up to seconds cold
You pay forEvery second it runsThe machines it runs on, or per taskUsually per second of runtime, through a platform built on themEach request and millisecond of runtime
Longest single runUnlimitedUnlimitedUnlimitedCapped, e.g. 15 minutes on Lambda
Cost when idleFull priceDepends; some platforms scale to zeroLow; platforms suspend or snapshot idle microVMs and charge only for stored stateZero
Reach for it forLegacy apps, special OS needs, full controlServices that must run the same everywhereRunning untrusted or multi-tenant code safelyEvent-driven glue and spiky, short tasks

Rule of thumb

These layer on each other more than they compete: containers usually run on VMs, and function platforms run your code inside containers or microVMs. The real questions are how much of the stack you want to own, and whether you trust the code you’re running.

Sources