System Design Academy

Saving…

Lesson 2 of 10 in Module 10 of 54 lessons complete

Clients and Servers

Module 1, lesson 2Concept10 min

Definition

Client

In plain English
A client is a program that asks another program for something over a network.
Think of it like
It is like a diner ordering from a waiter.

Server

In plain English
A server is a program that waits for requests and sends back responses.
Think of it like
It is like the kitchen that receives orders and sends out plates.

Network

In plain English
A network connects devices so their programs can exchange messages.
Think of it like
It is like roads connecting houses so deliveries can travel between them.

Why it exists

Your thermostat and phone need the same heating schedule. Separate copies drift apart when you change only one. A central server gives both devices one place to read and update it.

Update shared rules on the server instead of updating every device. Keep that server available and its data correct.

How it works

Request and response

In plain English
A request is a message asking for something, and a response is the message that answers it.
Think of it like
It is like a question and its reply in a text conversation.
  1. Build a request

    The client describes what it needs.

  2. Cross the network

    The message travels to the server.

  3. Do the work

    The server checks the request and reads stored data if needed.

  4. Return a response

    The result travels back to the client.

The browser requests data from the server, which queries the database. The database returns rows, and the server answers the browser.

The server can ask a database for information before answering.

The browser requests data from the server, which queries the database. The database returns rows, and the server answers the browser.

Peer-to-peer

In plain English
Peer-to-peer means devices exchange data directly rather than through a central data server.
Think of it like
It is like friends passing notes around a table instead of through the teacher.
PatternWho holds dataFailure riskTypical use
Client-serverA central service holds shared dataA lone server can stop everyoneShared schedules
Peer-to-peerParticipating devices hold dataTransfers between working devices continueDirect file transfer

Examples

Share a heating schedule

A thermostat reports temperature every 60 seconds; your phone reads it and sets a schedule.

The thermostat reports temperature every 60 seconds. Your phone reads the latest value and sets a schedule. Both are clients of the home server, even though they ask for different work.

The thermostat and phone app each connect to the same home server.

Two clients use the same home server.

The thermostat and phone app each connect to the same home server.

The insight

The server is the meeting point that both clients trust.

Trade-offs

Pros

  • Keep one shared version of the data.
  • Update shared rules in one place.
  • Keep clients focused.

Cons

  • One busy server slows everyone down.
  • Network failure can block clients.

Use when

  • Many clients share data.
  • Central control and access checks matter.

Avoid when

  • A task is entirely local.
  • A direct local transfer is enough.

Quick check

A weather-station server fetches forecasts from a government API. In that moment, what is the weather server?
Why do the thermostat and phone app both talk to one server instead of directly to each other?

Takeaways

  • Client asks, server answers.
  • Server is a role.
  • A central server keeps shared data together but risks slowing everyone down.

Try the quick check above whenever you feel ready.

Previous: What Is System Design?