contrib: add first draft of RPC docs

This commit is contained in:
Daniel Nephin 2021-07-05 18:13:25 -04:00
parent f13b8c17a1
commit 912b069375
4 changed files with 48 additions and 4 deletions

View File

@ -1,6 +1,50 @@
# RPC # RPC
- net/rpc - (in the stdlib) This section is a work in progress.
- [Streaming](./streaming)
- routing of "RPC" requests
The RPC subsystem is exclusicely in Server Agents. It is comprised of two main components:
1. the "RPC Server" (for lack of a better term) handles multiplexing of many different
requests on a single TCP port.
2. RPC endpoints handle RPC requests and return responses.
The RPC subsystems handles requests from:
1. Client Agents in the local DC
2. (if the server is a leader) other Server Agents in the local DC
3. Server Agents in other Datacenters
4. in-process requests from other components running in the same process (ex: the HTTP API
or DNS interface).
## Routing
The "RPC Server" accepts requests to the [server port] and routes the requests based on
configuration of the Server and the the first byte in the request. The diagram below shows
all the possible routing flows.
[server port]: https://www.consul.io/docs/agent/options#server_rpc_port
![RPC Routing](./routing.svg)
<sup>[source](./routing.mmd)</sup>
The main entrypoint to RPC routing is `handleConn` in [agent/consul/rpc.go].
[agent/consul/rpc.go]: https://github.com/hashicorp/consul/blob/main/agent/consul/rpc.go
## RPC Endpoints
This section is a work in progress, it will eventually cover topics like:
- net/rpc - (in the stdlib)
- new grpc endpoints
- [Streaming](./streaming)
## RPC connections and load balancing
This section is a work in progress, it will eventually cover topics like:
- agent/router
- agent/pool

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 34 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 34 KiB