01
The Backend's Role
The responsibilities the server side takes on: the responsibility boundary with the client, the roles of the web server and the runtime, a request's lifecycle from accept to response, and the middleware chain that orders cross-cutting concerns.
- 01 What the Backend Does The three responsibilities the server side takes on: keeping state in a single place, the point where business rules are enforced, and integration with systems the client cannot reach.
- 02 The Client and Server Responsibility Boundary The criteria that decide the choice when the same computation can be done on either side; bytes transferred, number of network round trips, and how binding the decision is are measured and compared.
- 03 The Web Server Concept The server side's three distinct roles: serving files with the correct headers, splitting requests by path, and handing a request off to a backend server, each set up and measured as a separate process.
- 04 The Application Runtime The process model beneath the application: how long work that blocks the event loop makes other requests wait is measured, the limit of the thread pool is shown, and why the unit of scaling is the process is counted with workers that share the same port.
- 05 The Request Lifecycle The path a request takes from connection accept to the last byte written is split into seven stages; timestamping each stage measures the order and durations, and shows that a connection and a request are separate things, and when the status line becomes irreversible.
- 06 The Middleware Chain An onion-model chain that gathers the work repeated on every request into one place is built; the same links are run in four separate orders, and the placement of identity checking relative to logging, the scope of the error catcher, and the correctness of the log lines are measured and compared.