Skip to content

ActualLab.Rpc: Diagrams

Diagrams for the RPC concepts introduced in Part 2.

RpcHub Architecture

ComponentDescription
RpcHubSingleton orchestrator managing all peers and service proxies
ServiceRegistryRegistry of RPC service definitions
DefaultPeerDefault peer for outbound calls
LocalPeerPeer for same-process calls
LoopbackPeerIn-process loopback for testing

RpcPeer Hierarchy

Peer TypeDirectionDescription
RpcClientPeerOutboundInitiates connections, handles reconnection with backoff
RpcServerPeerInboundReceives connections from server framework (e.g., ASP.NET)

Connection State Machine

StateDescription
DisconnectedNo active connection
ConnectingEstablishing connection and exchanging handshake
ConnectedActive connection, can send/receive messages

RpcPeerRef Types

PeerRefConnectionKindUse Case
DefaultRemoteStandard client-server communication
LocalLocalSame-process calls (no serialization)
LoopbackLoopbackTesting with serialization but no network
NewClient(host)RemoteConnect to specific host

RPC Call Flow

Compute Service Client Caching

ScenarioBehavior
Cache hit (consistent)Return immediately, no RPC
Cache missMake RPC, cache result
Server invalidationClient replica invalidated, next call triggers RPC

Invalidation Propagation

RpcStream Data Flow

DirectionDescription
Server → ClientStream items sent in chunks
Client → ServerAcknowledgments for backpressure

RpcStream Backpressure

PropertyDefaultDescription
AckPeriod30Consumer acks every N items
AckAdvance61Producer can send N items ahead before waiting