Network Abstractions: Remote Procedure Calls (RPC) 00:00:01 Make one unary call One line asks a remote service for user one hundred twenty-three. It looks like a local function call until the request leaves the machine and the reply fails to come back. Which local assumptions just became unsafe? The app writes client.GetUser(id="123"). It looks like a local call. The request goes over HTTP/2 as a POST to /user.UserService/GetUser. The server stub turns the bytes back into a request object. The User object becomes bytes on the server. The message goes back, followed by the status OK. The app gets a User object with id, name and email. The client stub encodes the request, the server decodes it and the reply crosses back. Instrument both sides so transport time can be separated from the service's own work. 00:00:57 Serialize the intended type What the 10 bytes of the request are. The text 123 is three bytes: 31 32 33 in hexadecimal. Field number 1 and the type for text give the tag 0a. The length is 3. One byte for compression and four bytes for the length, 5. A binary schema makes field identities and types part of the contract. Compact bytes still need validation and compatible evolution at both ends of a rolling deployment. 00:01:28 Stream several answers The client calls StreamUsers once. The server sends a user as soon as it has one. The client shows it at once. Users 2 and 3 follow on the same call. The server ends the stream with OK. Only now does the client know the list is complete. A stream can let a client begin processing before the entire result exists. It needs a policy for backpressure, cancellation and how much earlier work may need recovery after a disconnect. 00:01:57 The operation succeeded but its answer vanished CreateUser runs, and the reply disappears. Retry safely. The app calls CreateUser with request id r-7. The server inserts the user and stores the result under r-7. The connection breaks. The client reaches its deadline and cannot tell what happened. The client sends the same request with r-7 again. The server finds r-7 and returns the stored user. Nothing is inserted. A timeout alone cannot distinguish a request that never ran from one that committed. A repeat-safe operation identity or an explicit status query matters when the call has a durable effect. 00:02:37 Pass the remaining deadline The user gave 800 ms. Each call gets only what is left. The app sets a deadline of 800 ms and calls Orders. Orders used 300 ms. It passes the remaining 500 ms to Payments. Payments used 400 ms. Fraud gets 100 ms. Fraud needs 200 ms. At 800 ms everyone stops, and the user gets a clear error in time. Give a downstream client the time left in the original request, accounting for local work and network travel. Starting a fresh full timeout at every hop can exceed the caller's whole budget. 00:03:19 Let old and new clients coexist Old and new programs run at the same time during a deploy. Field 5, phone, is new. An old reader skips it. Field 3 is removed and its number is reserved. Suppose field 3 became a score. An old reader would treat those bytes as an email. Change schemas under compatibility rules and test mixed versions against each other. Never assume every process upgrades at the same instant simply because the client and server share a repository. A remote call has a contract, a deadline and an uncertain boundary between execution and acknowledgement. Making its syntax convenient does not remove those responsibilities from the caller.