What is a server?

A server is a computer that waits for requests. Learn what is inside one.

15 min read

You run next build, then next start. The terminal says the app is ready on localhost:3000.

At that moment, your laptop is a server. It waits, and it answers each request that arrives.

A server at work is the same idea, in a bigger box that never sleeps. In this lesson you open that box.

a rack server
A server with its lid off. Point at a part to lift it out: disks, CPUs, memory or the network card.

A server is a program that waits

The word "server" has two meanings. People use both, often in the same sentence.

  • The program. A program that starts, then waits for requests and sends back replies. next start is one. NGINX and PostgreSQL are others.
  • The machine. The computer that runs that program all day.
One machine, one waiting program. The browser asks, the program answers.

The program on a . Port 3000 is the door for your Next.js app. The next lesson explains ports in full.

So any computer can be a server. What makes a machine a "server" at work is its job: it runs a waiting program all day, for many users at once.

What is inside the machine

A server has the same four main parts as your laptop. It has more of each, and no screen or keyboard.

PartIts jobYour laptopA large cloud server
CPURuns the code8 to 16 cores192 vCPUs
Memory (RAM)Holds what runs now16 GB768 GiB
DiskKeeps files and data512 GB SSDDisks over the network
Network cardSends and gets dataWi-Fi50 Gbit/s

The large server in the table is a real AWS size, m7i.48xlarge. A is a cloud's way to count cores.

  • CPU. The does the work for each request: render a page, check a password, build JSON. More cores means more requests at the same time.
  • Memory. holds the running program and its data. When a server runs out of memory, the program slows down or crashes.
  • Disk. The disk keeps everything after a restart: the operating system, the app's files and the database.
  • Network card. Every request comes in and goes out through it.

When a site gets slow, the team asks which of these four ran out first. That question comes back in the monitoring chapter.

Racks, data centers and virtual machines

A physical server is a flat metal box. It slides into a , like a drawer.

Rack boxes come in a fixed height called a unit (U). One U is 1.75 inches (44.45 mm). A thin "1U" server is the box in the figure above.

A data center is rooms of racks. Each rack holds dozens of servers.

A keeps thousands of these racks cool, powered and online. Few companies build their own. Most rent space in someone else's.

Virtual machines

Most teams today do not touch hardware. They rent a , or VM, from a cloud such as AWS, Google Cloud or Azure.

A program called a cuts one big physical server into many VMs. Each VM runs its own full operating system. A new one takes minutes to start, not weeks.

Three rented VMs on one physical server. Each VM gets a share of the real parts.

On AWS, a VM is an EC2 instance. You pick an instance type, and the type sets the size.

A t3.micro has 2 vCPUs and 1 GiB of memory. An m7i.large has 2 vCPUs and 8 GiB.

  1. Your own serversbuy, rack and repair
  2. -Order hardware weeks ahead
  3. -Your team swaps broken disks
  4. -Pay up front, even when idle
  5. Rented VMsthe cloud owns the hardware
  6. +A new VM in a few minutes
  7. +The cloud swaps broken parts
  8. +Pay by the second, stop any time

Where your Next.js app runs

On Vercel, you never pick a server. Vercel calls this .

Serverless does not mean "no servers". It means the servers are someone else's job.

    1. Browseropens shop.com
  1. Vercel

    1. Vercel
      Vercel CDNsends static files
    2. dynamic page
      Next.js
      Vercel Functionrenders the page
  2. runs on
    1. Real serverin a data center
A dynamic page still runs on a CPU, in memory, in a data center.
  • Static files, such as images and prebuilt pages, come from Vercel's CDN. Load balancers, proxies and CDNs covers CDNs.
  • Dynamic code, such as a Route Handler or a server-rendered page, runs as a Vercel Function.
  • By default, Node.js functions run in one region: Washington, D.C. (iad1). You can move them closer to your database.
  • Vercel starts more copies when traffic grows. With no traffic, it stops them all.

Each copy is still a program on a server, with a CPU, memory and a network card. You rent a slice of it for each request, not the whole machine.

Remember4 points
  1. 01

    A server is a program that waits for requests, and also the machine that runs it all day.

  2. 02

    Every server has four main parts: CPU, memory, disk and network card.

  3. 03

    Physical servers sit in racks in data centers. Most teams rent virtual machines, slices of those servers.

  4. 04

    Serverless platforms like Vercel still run on servers. Someone else runs them.

Read more

The next lesson is "How a request reaches your app".