Networking & APIs
Every system design answer starts with "the client sends a request…". This chapter opens that black box: how a request finds the server, what it costs in round trips, and how to design the APIs your services expose. Interviewers expect you to talk about these confidently.
- C1.1The journey of one requestWhen you open https://example.com, four conversations happen before the page arrives: DNS lookup: the browser asks a DNS resolver "what's…
- C1.2HTTP essentials: methods, status codes, idempotencyHTTP methods carry meaning, and good APIs respect it: Method Use Safe? Idempotent? GET read a resource ✅ ✅ POST create / trigger an action…
- C1.3REST, GraphQL and gRPCREST GraphQL gRPC Shape Resources + HTTP verbs: GET /users/7/posts One endpoint; the client sends a query describing exactly the fields it…
- C1.4Pagination: offset vs cursorNever return an unbounded list. Two ways to page through results: Offset: ?offset=20&limit=10 Simple; can jump to page 7. Slow for deep…
- C1.5API gatewaysAn API gateway is the front door for many backend services. Clients talk to one host; the gateway handles the cross-cutting work so each…
- C1.6Real-time: polling, long polling, SSE, WebSocketsTechnique How Good for Cost Short polling Ask every N seconds Rare updates, simple clients Wasted requests, delay up to N s Long polling…