Learning paths / Cloud foundations / Servers and compute

What a server really is

Reading · 5 min · Module 2, lesson 1 of 420 min left in this module

Module 2 · Servers and computeLesson 1 of 4

Goal: Describe a server as a computer running a program that waits for requests, and name the parts it's made of.

Key idea

A server is an ordinary computer running a program that waits for requests and answers them. What makes it a server is the job, not the hardware: your laptop is one the moment you run your app on it.

Compute at a glance

Server
Waits for requests and answers them.
CPU
Runs your code. Too little: slow.
Memory
Working space. Too little: stopped.
Virtual machine
A machine's slice, with its own OS.
Container
An app and its needs, sharing a kernel.
The five ideas in this module.

Two meanings of one word

"Server" names two things, and people switch between them mid-sentence.

  • The program. A web server is software that listens for incoming connections and replies to each one. When you run npm run dev or python app.py, you start a server program.
  • The machine. The computer that program runs on, usually one of thousands in a data center.

When your app "works on localhost", your laptop is already the machine and your app is already the server program. Putting it online means running the same program on a machine other people can reach.

What's inside the machine

A server in a data center has the same parts as your laptop, just more of them and nothing you'd look at:

  • CPU: the processor that runs your code.
  • Memory (RAM): fast working space that's wiped when the power goes.
  • Disk: storage that keeps files when the machine is off.
  • Network card: its connection to the rest of the world.

There's no screen, keyboard or mouse. People manage servers from far away, over the network, by typing commands into a terminal.

Most servers run Linux, a free operating system that's good at running for months without anyone touching it. Your app doesn't need to know that, as long as whatever it depends on is installed there too.

Always on, always waiting

Your laptop sleeps when you close the lid. A server doesn't: its program sits in a loop, waiting for the next request, all day and all night. That's why a server has to recover on its own. If the program crashes at 3 a.m., something must start it again, or the site stays down until someone notices.

The next lessons look at the two parts that decide how much a server can handle: CPU and memory.

Check yourself

You run your app on your laptop and open it at localhost:3000. Is your laptop acting as a server?

In the docs