Design an RPC Layer Over Hand-Written REST Calls
A codebase calls its internal services through hand-written REST calls: URLs built by string concatenation, JSON assembled by hand, retries copied and pasted. Design an RPC abstraction layer to replace them.
Cover the interface definition and what is generated from it, marshalling, service discovery, deadlines, retries and their relationship with idempotency, and how interfaces evolve without breaking callers.
Hints
Hint 1
An interface definition generates client stubs and server skeletons, so the wire format, discovery and retry logic live in one place and callers write a method call.
Hint 2
Retry only idempotent calls, and give every request an id so a server can filter duplicates of the non-idempotent ones.
Hint 3
Versioning: additive changes to messages with defaults for new fields; a new method or a new version for anything else.
Asked at
Similar Problems6
- Design a Client for an Unreliable Token Servicemedium
- Design a Multi-Region API Whose Clients Need Tokens From a Flaky Third Partymedium
- Design a Logging Library for Web and Mobile Clientsmedium
- Count the Nodes in a Tree of Serversmedium
- Design the APIs for an Election Voting Systemmedium
- Design a Thread-Safe Batch Writermedium
Sign in to talk to the interviewer — ask what's in scope, what scale to design for, or for a nudge when you're stuck. Conversations save to your account.
Sign in to use the assistant — ask what the problem means, get a hint when you're stuck, or have your current work reviewed. Conversations save to your account.