EDIT: chunking delayed until we move to a simpler protocol negotiation mechanism. Until then, we settle on concurrent send/receive of whole messages
mirrord-protocol is our bincode-based protocol used for network communication between mirrord processes (e.g. mirrord-intproxy and mirrord-agent). It always utilizes a single TCP connection, and messages are always processed in a first-come first-served manner. This behavior causes issues when mirrord components compete for the connection. E.g. outgoing traffic feature is used to enable communication with remote databases, and often produces a lot of traffic. This traffic can significantly increase latency for other components, e.g. ping pong mechanism, which leads to timeouts and failures.
The idea here is to implement fair sharing of a single mirrord-protocol connection between multiple components, so that messages can be transferred concurrently, and each component has an equal share of total network bandwidth.
Essentially:
- Each
ClientMessage and DaemonMessage variant represents a separate message group.
- Within each message group, messages are processed sequentially.
- Groups are processed concurrently.
For instance, this could be implemented as follows (but more clever solutions are always welcome):
- Messages to send are chunked and added to their group's queue
- p's receive buffer
- When group's receive buffNext chunk to send is selected from the head of a random group's queue
- Received chunks are added to their grouer is ready, complete message is received
When implementing, mind that:
mirrord-protocol must remain backwards compatible. We normally use ClientMessage::SwitchProtocolVersion request to negotiate mirrord-protocol version with the peer. The negotiated version determines which messages can be sent over the wire.
- This extension should not introduce any significant time or memory overhead.
EDIT: chunking delayed until we move to a simpler protocol negotiation mechanism. Until then, we settle on concurrent send/receive of whole messages
mirrord-protocolis our bincode-based protocol used for network communication between mirrord processes (e.g.mirrord-intproxyandmirrord-agent). It always utilizes a single TCP connection, and messages are always processed in a first-come first-served manner. This behavior causes issues when mirrord components compete for the connection. E.g. outgoing traffic feature is used to enable communication with remote databases, and often produces a lot of traffic. This traffic can significantly increase latency for other components, e.g. ping pong mechanism, which leads to timeouts and failures.The idea here is to implement fair sharing of a single
mirrord-protocolconnection between multiple components, so that messages can be transferred concurrently, and each component has an equal share of total network bandwidth.Essentially:
ClientMessageandDaemonMessagevariant represents a separate message group.For instance, this could be implemented as follows (but more clever solutions are always welcome):
When implementing, mind that:
mirrord-protocolmust remain backwards compatible. We normally useClientMessage::SwitchProtocolVersionrequest to negotiatemirrord-protocolversion with the peer. The negotiated version determines which messages can be sent over the wire.