advanced path

RPC Services at Scale

The service in front of the network: JSON-RPC 2.0 done exactly, Serde at the edge, Tower layers for timeout and rate limiting, and the architecture questions an interview will actually ask.

serves: RPC/API services at high scale7 lessons · ~5h
progress0/7
Start track

// lessons

  1. 01

    The JSON-RPC 2.0 Envelope and Its Five Error Codes

    Classify any inbound request into the right JSON-RPC error code, and know the two cases where the response id must be null rather than echoed.

  2. 02

    Notifications, Batches and the Requests You Must Not Answer

    Implement the two rules that break naive JSON-RPC servers: a notification gets no response at all, and an empty batch is itself an invalid request.

  3. 03

    A Method Dispatch Table of Boxed Handlers

    Build a router from a HashMap of boxed closures, and separate the three failures a call can have: no such method, bad arguments, handler blew up.

  4. 04

    Service and Layer: Building Tower From Two Traits

    Write the two traits the whole Tower ecosystem is made of, then wrap a backend in a timeout and prove the timed-out requests never reach it.

  5. 05

    Concurrency Limits and Load Shedding

    Simulate the same overload under two admission policies and read off what queueing actually costs: the same successes, plus 320ms of backend time spent on responses nobody can use.

  6. 06

    A Token-Bucket Rate Limiter on a Simulated Clock

    Implement per-client token buckets with lazy refill, return a retry_after the client can act on, and see why the limit you configure is not the limit your fleet enforces.

  7. 07

    Pagination Contracts: Cursors, Offsets and Request IDs

    Prove that OFFSET paging silently drops rows when the collection changes mid-walk, and write the cursor contract that does not.

Every exercise compiles and runs in the Forge sandbox — standard library only, no external crates.