3 Remote Procedure Calls
Remote Procedure Call Protocol (RPC)
- Call a remote function to get data, have them compute for you
- In typical RPC, client waits for server's response before continuing, making it inherently synchronous (block until finish)
- Pros:
- Modularity
- Scalable
- Programming language independence
- Offload expensive functions to powerful servers
Stubs in RPC
- helper that makes remote function calls look like local calls
- Then, RPC Runtime passes encoded data over the network to server
RPC Workflow
- Client stub sends request
- RPC runtime encodes (serialize) data
- send to server
- Server RPC continually listens for messages, receives it
- Server's dispatch code receives and decodes data
- Server compute
- Serialize & send it back
Serialization (Data marshalling)
Converting in-memory data (like a Go struct) into transferable format; Deserialization: rebuilding it back