Leer en español · Lire en français · Auf Deutsch lesen
Section 0.7 of 0.8 · Beginner · 18 min read
Servers, operating systems, virtual machines, containers and cloud services
Video lesson
5 min · narrated, with captionsListen only (audio)
Read the transcript
Every app you use runs somewhere: on a server, in a data centre, and more and more often, in the cloud. Most organisations now rent computing instead of buying their own, much as homes buy electricity from the grid rather than running a generator.
A server is simply a computer whose job is to wait for requests and answer them. The word describes a role, not a special kind of machine. Server hardware has the same parts as any computer, but it's built to run for years: many processor cores, spare power supplies and disks, and no screen or keyboard at all. Servers live in data centres: buildings full of racks, with cooling, backup power from batteries and generators, and tight security. Running your own means buying machines months before you need them, guessing how many, and paying for them whether they're busy or idle. That's the problem the cloud set out to solve.
A server running one application sits mostly idle. A virtual machine, or VM, lets one physical machine pretend to be several. A layer of software called the hypervisor shares out the real hardware among the virtual machines, and keeps them apart, so a crash or attack in one doesn't reach the others. Each virtual machine runs its own complete operating system, called the guest. That gives strong isolation, but each one takes gigabytes and minutes to start. A container packages an application with everything it needs, such as its libraries and settings, so it runs the same way on a laptop or in the cloud. That solves the old excuse: it works on my machine. Containers share the host's operating system kernel, so they take megabytes and start in seconds. The price is weaker isolation, which is why cloud providers commonly run containers inside virtual machines.
Cloud computing means renting computing over the internet, on demand, from a provider that runs huge data centres. Amazon Web Services, Microsoft Azure and Google Cloud are the largest. You create resources yourself, in minutes. Many customers share the provider's hardware. Capacity grows and shrinks quickly, and you pay for what you use. A start-up can rent a hundred servers for an afternoon, then hand them back. There's a new risk, though: costs that grow quietly, because nothing stops anyone creating resources and forgetting them.
Cloud services differ in how much the provider manages for you. Think of pizza: make it at home, bake a ready-made one, get it delivered, or eat out. With infrastructure as a service, you rent virtual machines, and you still look after the operating system and everything above it. With platform as a service, you supply only your code and data. The platform handles the servers, patching and scaling. Serverless doesn't mean there are no servers; you just never see them. You upload functions, and pay per call. It's cheap for spiky traffic, but the first call after a quiet spell can be slow. And software as a service is finished software you simply use. Whichever you choose, you always remain responsible for your own data, access and settings.
Providers group their data centres by geography. A region is an area, such as Ireland or Frankfurt. Inside it are several availability zones: physically separate data centres with their own power, cooling and network. Here a load balancer spreads users' requests across copies of the application in two zones. The main database in zone one keeps a standby copy in zone two. If a fire or power failure takes out one zone, the service keeps running. And a content delivery network keeps copies of images, scripts and video in locations near users, so pages load faster and the servers handle far fewer requests.
Let's put this together. A small theatre chain sells tickets online. Traffic is light most of the week, but when a popular show goes on sale, ten times as many people arrive within minutes. One rented virtual machine is simple and cheap. But on sale day it's overwhelmed, and if it fails, the site is down. A bigger machine is called scaling up. It needs no code change, but the theatre pays for that big machine all week, to cover a few busy hours. Scaling out means more copies behind a load balancer. The platform adds copies on sale day and removes them afterwards. But the software must be designed for it: a user's next request might reach a different copy. Finally, a managed database with a standby in another zone, and a content delivery network for the photos. It costs more to set up, but survives both a traffic spike and the loss of a data centre.
Where software runs is now an architectural decision, shaping cost, speed of release and what happens when things fail. The full section has much more. Next, in Section zero point eight, we look at how software gets built.
What you need to know
- A server is any computer, or program, that waits for requests and answers them; most internet servers run Linux and live in data centres built for power, cooling and security.
- A hypervisor lets one physical machine run several virtual machines, each with its own guest operating system, isolated from the others.
- A container packages an application with its libraries and settings and runs as an isolated process sharing the host's kernel, so it is lighter and faster to start than a VM but less strongly isolated.
- Cloud computing (NIST SP 800-145) means on-demand, self-service, pay-as-you-go access to pooled, elastic resources over the network.
- IaaS, PaaS, serverless (FaaS) and SaaS hand progressively more of the stack to the provider, trading control for less operational work; customers always remain responsible for their data and configuration.
- Regions are isolated geographic areas; availability zones are separate data-centre groups within a region; CDNs serve static content from edge locations near users.
- Scaling up means a bigger machine; scaling out means more machines behind a load balancer, which scales further and survives failures only if the software is designed for it.
A server is just a computer that serves
A server is a computer whose job is to wait for requests and answer them: web pages, API calls, database queries, files. The word describes a role, not a special kind of machine. A laptop running a small web application is a server while it answers requests; a rack-mounted machine in a data centre is a server because that is all it ever does. The same word is also used for the program doing the serving (a "web server" such as nginx), so context matters.
Server hardware has the same parts as any computer (see what software is): processors, memory, storage and network cards. It differs in emphasis. Servers usually have many processor cores, large amounts of memory, redundant power supplies and disks so that one failed part does not stop the machine, remote management so that nobody has to be in the room, and no screen or keyboard at all. They are built to run for years without being switched off.
Most servers on the internet run Linux or another Unix-like operating system; Windows Server is common inside organisations that rely on Microsoft products. A server operating system does the same jobs as the one on your laptop (running processes, managing memory and files, talking to the network) but is usually administered through a text command line over a remote connection, and is configured so that it can be rebuilt automatically rather than by hand.
Data centres: where the servers live
Servers are kept in a data centre: a building designed around their needs. Thousands of machines sit in racks, cooled by air or liquid because they turn almost all of their electricity into heat. Power arrives over more than one supply, backed by batteries for the first seconds of an outage and by diesel generators after that. Network connections come from several providers. Doors need badges, and often fingerprints.
An organisation can run its own data centre or rent rack space in someone else's (called colocation), and before about 2006 that was nearly the only choice. Running servers yourself (on-premises) means buying machines months before you need them, guessing how many, paying for them whether they are busy or idle, and employing people to replace failed disks at night. That cost and inflexibility is the problem the cloud set out to solve.
Virtual machines: many computers inside one
A typical server sits mostly idle if it runs one application. A virtual machine (VM) lets one physical machine pretend to be several. Each VM believes it is a complete computer with its own processors, memory, disk and network card, and runs its own operating system, called the guest. A layer of software called the hypervisor shares out the real hardware among the VMs and keeps them apart, so that a crash or attack in one does not reach the others. Some hypervisors run directly on the hardware (VMware ESXi, Microsoft Hyper-V, KVM, which is part of Linux); others run as an application on a normal operating system (VirtualBox).
Virtualisation changed the economics of servers. One machine can be packed with VMs from different teams or customers. A VM is a set of files, so it can be copied, backed up, moved to another machine and created in minutes instead of being ordered and delivered. Note that this is a different use of "virtual machine" from the language VMs such as the Java Virtual Machine mentioned in what software is: those run programs, these imitate whole computers.
Containers: shipping the application with everything it needs
Every developer has heard "it works on my machine". The program depends on a particular language version, particular libraries and particular settings, and the server has slightly different ones. A container solves this by packaging an application together with everything it needs to run (its runtime, libraries, configuration) into a standard unit that runs the same way on a laptop, a test server or the cloud. The name comes from shipping containers: standard boxes that any crane, ship or lorry can handle without knowing what is inside.
The package is a container image: a read-only, versioned file built from a short recipe (with Docker, a Dockerfile). A running copy of an image is a container. Docker, released in 2013, made this practical for everyday developers, and its image format is now an open standard maintained by the Open Container Initiative, so other tools can build and run the same images.
The key difference from a VM is what is shared. A VM imitates hardware and runs a whole guest operating system. A container is an isolated process: it shares the host's operating-system kernel (the core of the operating system, which controls the hardware, memory and processes) with other containers, and the kernel's isolation features give it its own view of files, processes and network. Containers therefore start in seconds or less and take megabytes rather than gigabytes, so dozens can run where a few VMs would fit. The price is weaker isolation, because every container depends on the one shared kernel; that is why cloud providers commonly run customers' containers inside VMs, combining both.
Virtual machines and containers compared
# Start from an image that already has Python installed
FROM python:3.12-slim
WORKDIR /app
# Bake the libraries into the image
COPY requirements.txt .
RUN pip install -r requirements.txt
# Add the application code
COPY . .
EXPOSE 8000
CMD ["python", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]Running one container is easy. Running hundreds across dozens of machines, restarting the ones that crash, adding copies when traffic rises and rolling out new versions without downtime is not. That job is done by an orchestrator, of which Kubernetes is the best known; it is covered in containers and orchestration.
The cloud: renting computing by the minute
Cloud computing means renting computing resources over the internet, on demand, from a provider that runs huge data centres: Amazon Web Services (AWS), Microsoft Azure and Google Cloud are the largest, with many others. The US National Institute of Standards and Technology (NIST) published the definition most people cite, Special Publication 800-145, in 2011. It lists five essential characteristics: on-demand self-service (you create resources yourself, through a website or an API, without phoning anyone), broad network access, resource pooling (many customers share the provider's hardware), rapid elasticity (capacity grows and shrinks quickly) and measured service (you pay for what you use).
The analogy is electricity. Factories once ran their own generators; now they plug into the grid and pay per kilowatt-hour. With the cloud, a start-up can rent a hundred servers for an afternoon to test a launch, and stop paying when it hands them back. That is pay-as-you-go pricing. It turns a large up-front purchase into a running cost, and it rewards systems that can switch capacity off when it is not needed. It also creates a new risk: costs that grow quietly, because nothing stops anyone creating resources and forgetting them.
IaaS, PaaS, SaaS and serverless: how much do you manage?
Cloud services differ mainly in how much of the stack the provider manages for you. NIST defined three service models; a fourth, serverless, became popular after AWS launched its Lambda service in 2014. A popular way to remember them is pizza: you can make it at home, buy a ready-made one to bake, have one delivered, or eat out. Each step hands more of the work to someone else, and takes away some of your choices.
Cloud service models compared
| Model | You manage | The provider manages | Examples | Pizza analogy |
|---|---|---|---|---|
| On-premises | Everything: building, hardware, OS, runtime, application, data | Nothing | Your own servers in your own data centre | Made at home from scratch |
| IaaS (infrastructure as a service) | Operating system, runtime, application, data | Hardware, virtualisation, network, building | Amazon EC2, Azure Virtual Machines, Google Compute Engine | Take-and-bake: you cook it in your own oven |
| PaaS (platform as a service) | Application code and data | Everything underneath, including OS patching and scaling | Heroku, Azure App Service, Google App Engine | Delivery: you supply the table and drinks |
| Serverless / FaaS (function as a service) | Individual functions, triggered by events | All servers, scaling to zero when idle, billing per call | AWS Lambda, Azure Functions, Google Cloud Run functions | Pizza by the slice, paid per bite |
| SaaS (software as a service) | Your data, your users and their settings | The entire application | Microsoft 365, Gmail, Salesforce | Eating at a restaurant |
"Serverless" does not mean there are no servers; it means you never see or manage them. You upload a function, say which events trigger it (an HTTP request, a file arriving, a message on a queue), and the provider runs as many copies as needed and charges per execution and per millisecond. It is cheap for spiky or low traffic and needs almost no operations work. Its costs show up elsewhere: the first call after a quiet spell can be slow while the provider starts the function (a cold start), there are limits on how long a function may run, and costs can exceed a plain server's for steady heavy traffic. Chapter 6 discusses serverless architectures in depth.
Between these models sit the managed services: databases, message queues, caches, object storage, search engines and many more, which the provider installs, runs, patches, backs up and scales. Using a managed database instead of installing one on a VM moves a large amount of operational work to the provider. The trade-off, discussed in FinOps and lock-in, is that the more provider-specific services a system uses, the harder it is to move.
Regions, availability zones and content delivery networks
Cloud providers group their data centres by geography. A region is a geographic area (such as Ireland, Frankfurt or Virginia) with its own separate set of data centres, isolated from other regions. Each region is divided into several availability zones: physically separate groups of one or more data centres, each with independent power, cooling and networking, typically kilometres apart but close enough for fast connections between them. A fire, flood or power failure should take out at most one zone.
This gives architects a menu of protection. Running copies of an application in two or three zones of one region survives the loss of a data centre at little extra latency; running in two regions survives the loss of a whole region but makes keeping data in step much harder. Regions also matter for law and latency: data protection rules may require personal data to stay in a particular jurisdiction, and users are served faster from a region near them, because no network can beat the speed of light (see how computers talk).
A content delivery network (CDN) pushes this further for content that does not change per user, such as images, style sheets, scripts and video. It keeps copies on servers in hundreds of locations, called edge locations, so that a user in Nairobi fetches the shop's product photos from a nearby city rather than from a data centre in Europe. The page loads faster, and the shop's own servers handle far fewer requests. Many CDNs also absorb attack traffic and can run small pieces of code at the edge.
Inside a region
Scaling up and scaling out
When a system needs to handle more work there are two basic moves. Scaling up (vertical scaling) means a bigger machine: more cores, more memory. It needs no change to the software, which is its great advantage, but there is a largest machine you can buy, it gets disproportionately expensive near the top, and one machine is still one point of failure. Scaling out (horizontal scaling) means more machines sharing the work, usually behind a load balancer that spreads requests across them and stops sending to any that fail. It can grow far further and survive machine failures, but only if the software is designed for it: for example, a server must not keep a user's session only in its own memory, or save uploaded files only on its own disk, if the user's next request might go to a different server.
The cloud makes scaling out attractive because adding a machine is an API call, and autoscaling can add and remove copies automatically as load changes. Databases are usually the hardest part to scale out, which is why Chapter 7 spends a section on replication and partitioning.
Worked example
Worked example: hosting a ticket-booking site
A small theatre chain sells tickets online. Traffic is light most of the week, but when a popular show goes on sale, ten times as many people arrive within minutes.
| One rented VM (IaaS) | Simple and cheap. The team patches the OS. On sale day the single machine is overwhelmed, and if it fails the site is down. |
|---|---|
| Bigger VM | Scaling up buys headroom with no code change, but the theatre pays for the big machine all week to cover a few busy hours. |
| App on a PaaS, two zones, autoscaling | Copies of the app run in two availability zones behind a load balancer. On sale day the platform adds copies automatically and removes them afterwards. Requires the app to keep no session data in local memory. |
| Managed database | The provider runs a primary in one zone and a standby in another, with automated backups. The team still designs the schema and indexes (see storing data). |
| CDN for images and scripts | Seating plans and show photos are served from edge locations, so the app servers spend their effort on bookings. |
The final design costs more to set up than one VM but less to run than a permanently oversized machine, and it survives both a traffic spike and the loss of a data centre.
Every step traded control for convenience: the team chose which work to keep and which to hand to the provider.
Why this matters for architecture
Where software runs is now an architectural decision rather than an afterthought. The choice between VMs, containers, platforms and functions shapes cost, how quickly the team can release, how the system scales and what happens when a data centre fails. Regions and zones turn availability targets into concrete deployment plans; managed services trade operational work for dependence on a provider. Chapter 9 develops scaling strategies, and Chapter 10 covers cloud service and deployment models, containers and infrastructure in professional depth.
Check your understanding
Why do containers start faster and use less space than virtual machines?
A container does not boot its own operating system: it is an isolated process sharing the host's kernel and carries only the application and its libraries. A VM carries and boots a full guest operating system.
A team rents a VM in the cloud and installs its own database on it. Who is responsible for patching the operating system?
The team. With IaaS the provider manages the hardware and virtualisation, and the customer manages the operating system and everything above it.
What failure does running in two availability zones protect against, and what does it not protect against?
It protects against the loss of one data centre or zone (power, fire, network). It does not protect against the loss of the whole region, or against software bugs and bad data, which affect every copy.
Why might an application that works fine on one server misbehave when scaled out behind a load balancer?
It may keep state such as user sessions in its own memory, so when the load balancer sends the next request to another copy, that copy does not know the user.
Sources and further reading
Have a question about this section? ArchitectBot, the course’s AI study assistant, answers from the course first.
Ask: “For a small web application with spiky traffic, how do I choose between running it on a virtual machine, in containers on a platform, or as serverless functions?”