Fundamentalschapter 2 of 6 · 4 lessons
Client-Server Model
Clients request, servers respond. The foundation of the web.
You type an address and press enter. About 400 milliseconds later there is a page.
In that time your machine worked out which server to talk to, opened a connection across a few thousand kilometres, agreed on how to encrypt it, sent a few hundred bytes describing what it wanted, and a machine you will never see read a row out of a database and sent it back.
Most engineers can name message queues and microservices and cannot narrate those 400 milliseconds in order. The opening minutes of an interview tend to find that gap, because every architecture you will ever draw is stacked on top of this one exchange.
Lessons
4 in this chapter- The Request-Response LoopThe client always speaks first. The server can only answer.2 min
- Before the First ByteDNS, TCP, and TLS all charge round trips before your API sees anything.2 min
- HTTP Verbs and Status CodesThe method tells the server what kind of change you intend. Idempotency is the property that matters.2 min
- State on a Stateless ProtocolHTTP forgets you between requests. Cookies and tokens are how apps remember anyway.2 min