Skip to content

[meshnet] Use gRPC streaming - #732

Merged
kraney merged 1 commit into
openconfig:mainfrom
kraney:meshnet-stream
Aug 11, 2026
Merged

[meshnet] Use gRPC streaming#732
kraney merged 1 commit into
openconfig:mainfrom
kraney:meshnet-stream

Conversation

@kraney

@kraney kraney commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Note: Stacks on top of #731, new changes start at sha:6c4cadb3e02b85a880015fa7561ae40d2ad12d53. Please merge that PR first.

  1. Bidirectional Streaming (SendToStream) Receiver (handler.go):
      • Implemented SendToStream(stream mpb.WireProtocol_SendToStreamServer) error.
      • In a loop, stream.Recv() continuously ingests incoming mpb.Packet frames and writes them directly to the
      destination TAP interface (wrHandle.Write(pkt.Frame)), bypassing per-packet unary RPC overhead.
  2. Streaming Sender & Auto-Reconnect (grpcwire.go):
      • Updated RecvFrmLocalPodThread to establish a persistent client stream (wireClient.SendToStream(ctx)).
      • Frames read from the local TAP interface are streamed out via st.Send(payload) without blocking for individual
      RPC responses.
      • If the stream encounters a network or peer reset, RecvFrmLocalPodThread automatically clears its stream handle
      and transparently re-establishes SendToStream on the next packet.
  3. HTTP/2 Window Size & Buffer Tuning:
      • Server Configuration (meshnet.go):
          • Stream window size: 4 MB (grpc.InitialWindowSize(4 * 1024 * 1024)).
          • Connection window size: 16 MB (grpc.InitialConnWindowSize(16 * 1024 * 1024)).
          • Max message payload: 64 MB (grpc.MaxRecvMsgSize / grpc.MaxSendMsgSize).
      • Client Configuration (grpcwire.go):
          • Configured matching initial window size and message payload limits on client grpc.Dial.

  1. Bidirectional Streaming (SendToStream) Receiver (handler.go):
      • Implemented SendToStream(stream mpb.WireProtocol_SendToStreamServer) error.
      • In a loop, stream.Recv() continuously ingests incoming mpb.Packet frames and writes them directly to the
      destination TAP interface (wrHandle.Write(pkt.Frame)), bypassing per-packet unary RPC overhead.
  2. Streaming Sender & Auto-Reconnect (grpcwire.go):
      • Updated RecvFrmLocalPodThread to establish a persistent client stream (wireClient.SendToStream(ctx)).
      • Frames read from the local TAP interface are streamed out via st.Send(payload) without blocking for individual
      RPC responses.
      • If the stream encounters a network or peer reset, RecvFrmLocalPodThread automatically clears its stream handle
      and transparently re-establishes SendToStream on the next packet.
  3. HTTP/2 Window Size & Buffer Tuning:
      • Server Configuration (meshnet.go):
          • Stream window size: 4 MB (grpc.InitialWindowSize(4 * 1024 * 1024)).
          • Connection window size: 16 MB (grpc.InitialConnWindowSize(16 * 1024 * 1024)).
          • Max message payload: 64 MB (grpc.MaxRecvMsgSize / grpc.MaxSendMsgSize).
      • Client Configuration (grpcwire.go):
          • Configured matching initial window size and message payload limits on client grpc.Dial.
@kraney
kraney merged commit 10b30a3 into openconfig:main Aug 11, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants