Skip to content

Commit 7aa6bab

Browse files
authored
Merge pull request #73 from docker/docs/ipc
docs: cleanup ipc design doc
2 parents 8300a57 + 0e2df89 commit 7aa6bab

1 file changed

Lines changed: 25 additions & 19 deletions

File tree

internal/ipc/design.md

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -30,32 +30,14 @@ flowchart TD
3030
3131
```
3232

33-
## Choosing a multiplexer
34-
The multiplexer adds a custom layer on top of the socket that allows running servers on both ends of the socket.
35-
36-
### nri/net/multiplex - a minimal multiplexer
37-
The plugin system in [containerd/nr](https://github.com/containerd/nri) implements its own simple frame-based multiplexer [nri/net/multiplex](https://github.com/containerd/nri/tree/main/pkg/net/multiplex).
38-
It provides two streams on each side that need to be re-used for all communication.
39-
This works well for [ttrpc](https://github.com/containerd/ttrpc) which uses its own length-prefixed framing.
40-
However, the standard Go HTTP server inside `Server(net.Listener)` does one `Accept()`, gets one `net.Conn`, and then loops inside serveConn to decode requests.
41-
But because that sub-connection isn’t a real socket—and because the mux delivers no further “new connections” and any pipelined data after the first request can get lost or stuck in the mux’s framing, and the server never sees it.
4233

43-
Alternatively, HTTP/2 without TLS could be used as it gives control over the framing.
44-
Unfortunately, Go's `net/http` package does not easily support HTTP/2 without TLS and getting it to work comes with its own set of challenges, such as requiring a custom `net.Listener` implementation that handles the HTTP/2 framing.
45-
46-
TLDR: [nri/net/multiplex](https://github.com/containerd/nri/tree/main/pkg/net/multiplex) is not ideal for general HTTP servers.
47-
48-
### Yamux
49-
50-
Yamux is a full-featured, multiplexing protocol that allows multiple streams to be sent over a single TCP connection. It is actively maintained by Hashicorp and is used by Hashicorp's Nomad.
51-
Using Yamux we get Go's `net/http` out-of-the-box.
5234

5335

5436
## Decisions
5537

5638
---
5739

58-
2025-07-02 IPC stack
40+
### 2025-07-02 settling on yamux + connect rpc for the IPC stack
5941

6042
The IPC stack consists of multiple parts that need to play well together:
6143
- socket multiplexing
@@ -80,3 +62,27 @@ In addition, the main performance bottleneck will be within the actual plugins d
8062

8163
---
8264

65+
### 2025-06-27 dropping nri/net/multiplex in favor of yamux
66+
67+
The multiplexer adds a custom layer on top of the socket that allows running servers on both ends of the socket.
68+
69+
#### nri/net/multiplex - a minimal multiplexer
70+
71+
The plugin system in [containerd/nri](https://github.com/containerd/nri) implements its own simple frame-based multiplexer [nri/net/multiplex](https://github.com/containerd/nri/tree/main/pkg/net/multiplex).
72+
It provides two streams on each side that need to be re-used for all communication.
73+
This works well for [ttrpc](https://github.com/containerd/ttrpc) which uses its own length-prefixed framing.
74+
However, the standard Go HTTP server inside `Server(net.Listener)` does one `Accept()`, gets one `net.Conn`, and then loops inside serveConn to decode requests.
75+
I.e. it tries to create (and on completion closes) a new stream per request but using nri/net/multiplex gets stuck as nri/net/multiplex is only design to return one stream per lifetime.
76+
77+
Alternatively, HTTP/2 without TLS could be used as it gives control over the framing.
78+
Unfortunately, Go's `net/http` package does not easily support HTTP/2 without TLS and getting it to work comes with its own set of challenges, such as requiring a custom `net.Listener` implementation that handles the HTTP/2 framing.
79+
80+
TLDR: [nri/net/multiplex](https://github.com/containerd/nri/tree/main/pkg/net/multiplex) is not ideal for general HTTP servers.
81+
82+
#### Yamux
83+
84+
Yamux is a full-featured, multiplexing protocol that allows multiple streams to be sent over a single TCP connection. It is actively maintained by Hashicorp and is used by Hashicorp's Nomad.
85+
Using Yamux we get Go's `net/http` out-of-the-box.
86+
87+
---
88+

0 commit comments

Comments
 (0)