iverse.deviverse.dev

Why your laptop isn't a server

Jem Young4 min

tl;dr

Availability, collaboration and scale each rule out running it locally. Cloud computing is renting server time, virtualization is what makes it cheap, and a VPS is your slice.

You wrote a server. It runs on localhost:3000. Why not just build on that?

And real setups are never one server. There are redundancies — failover, power outages, updates. Half the fleet goes down for a patch while the other half keeps answering — that pattern has a name, red/green, and it's one of several update strategies. That whole world of server management is normally invisible to frontend engineers.

Cloud computing is a rental agreement

Ten years ago you could get away with a server rack in the company basement, and plenty of firms still do — Goldman Sachs and the like keep them in the fire-resistant part of the building, because servers run hot.

What replaced it isn't complicated, despite the branding. Cloud computing is the idea that there's a giant pile of servers somewhere and you can rent time on it. AWS, DigitalOcean, Rackspace. That's the whole concept — you're outsourcing to people who do this better than you, instead of hiring a sysadmin.

Virtualization is the trick that made it cheap

One physical 32-core machine divided into eight virtual private servers, with one highlighted as yours.
Twenty years ago you rented the whole machine whether you needed it or not. Now the machine is divided and you take a slice.

Dividing a machine's resources into virtual computers sounds obvious now, and it was genuinely hard. Computers were built for multiprocessing and multithreading; pinning one thread to one core was foreign to them. Early cloud computing was bumpy for exactly this reason, and it took processors designed for virtualization to smooth it out.

Side by side: a virtual machine cloning cpu, memory, disk, GPU and a second OS, against a VPS taking only a few cores, a share of memory and your OS.
A VM is a whole second computer, which is why it costs like one. A VPS is a share of a real one.

Nearly every modern web application runs on a VPS. Facebook is a notable exception, running its own hardware, but that's a different scale of problem.

← all Full Stack Fundamentals, v3 posts