Remote Procedure Calls

In this chapter, we split CodeDrill, a practice site for programming problems, into two services, and design the call from one service to the other as a remote procedure call.

After reading this chapter, you should be able to:

  • Explain why running code belongs in a service separate from the rest of the application
  • Decide whether the runner reads the tests or receives them with each call
  • Explain why running code fits a resource-oriented REST API poorly, and define a remote procedure call
  • Read a JSON-RPC request and response, and decide whether an outcome is a result or an error
  • Explain what a client stub and a server stub do
  • Choose how long to wait for the runner, and decide what happens to a submission when no results arrive
  • Explain what gRPC offers compared with JSON-RPC
  • Explain how tRPC checks a call against the server’s own types, and when it fits the API between a browser client and its server
  • Choose between REST and RPC for an API

Sections

  1. CodeDrill
  2. A Service for Running Code
  3. Calling the Runner
  4. JSON-RPC
  5. A Client for the Runner
  6. When a Call Fails
  7. gRPC
  8. tRPC
  9. RPC or REST