You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: internal/ipc/design.md
+27Lines changed: 27 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,5 +51,32 @@ Yamux is a full-featured, multiplexing protocol that allows multiple streams to
51
51
Using Yamux we get Go's `net/http` out-of-the-box.
52
52
53
53
54
+
## Decisions
54
55
56
+
---
57
+
58
+
2025-07-02 IPC stack
59
+
60
+
The IPC stack consists of multiple parts that need to play well together:
61
+
- socket multiplexing
62
+
- API format (includes networking protocol + serialization format)
63
+
64
+
At this point in time we have decided to go with yamux + connect rpc.
65
+
Connect rpc in itself uses protobuf for data serialization combined with gRPC over http for networking.
66
+
A main advantage is that we can keep using Go's standard library's `net/http` stack for server and client.
67
+
See [Connect: A better gRPC](https://buf.build/blog/connect-a-better-grpc) for a detailed comparison against e.g.`grpc-go`.
68
+
Also connect rpc is part of CNCF ([source](https://www.cncf.io/projects/connect-rpc/)).
69
+
70
+
Potential drawbacks: Performance
71
+
72
+
Using [nri/net/multiplex](https://github.com/containerd/nri/tree/main/pkg/net/multiplex) with [ttrpc](https://github.com/containerd/ttrpc) probably would be the most performant solution.
73
+
It re-uses one stream over the multiplexed socket per direction and does not have the overhead of the HTTP protocol as Protobuf gets streamed directly over the multiplexer.
74
+
Although lightweight, it has stopped evolving and has not caught up to the latest improvements on Protobuf.
75
+
Another major downside is that it's mainly Go only.
76
+
Plugins written in a different language would come at a high cost.
77
+
78
+
We argue that in our use case since the networking only happens locally the overhead of GRPC over HTTP and the cost of opening a new yamux stream per API request are negligible.
79
+
In addition, the main performance bottleneck will be within the actual plugins due to IO operations, additional upstream network requests and potentially authentication.
iferrors.Is(err, http.ErrServerClosed) { // not an error, client closed the connection
69
71
err=nil
70
72
}
71
-
result.err=errors.Join(filterEOF(err), onClose(err)) // EOF: only forward to the onClose handler, but filter out internal forwarding
73
+
result.err=errors.Join(filterBrokenPipe(filterEOF(err)), afterClose(err)) // EOF: only forward to the afterClose handler, but filter out internal forwarding
0 commit comments