Skip to content

feat: add unix domain socket (uds) transport#96

Draft
Frando wants to merge 5 commits intomainfrom
uds
Draft

feat: add unix domain socket (uds) transport#96
Frando wants to merge 5 commits intomainfrom
uds

Conversation

@Frando
Copy link
Member

@Frando Frando commented Feb 28, 2026

This adds irpc-uds, a new transport crate that runs QUIC over Unix datagram sockets with plaintext crypto. The implementation uses quinn's AsyncUdpSocket trait over tokio::net::UnixDatagram with a fake SocketAddr mapping layer, so no changes to irpc core are needed.

(impl'd by Claude Opus, wanted to try this for quite a while)

Bench results:

=== Sequential small RPCs (n=10_000) ===
  local       124_161 rps
  quinn        15_984 rps
  iroh         14_518 rps
  uds          20_709 rps

=== Concurrent small RPCs (n=10_000, parallelism=32) ===
  local     1_246_483 rps
  quinn        74_524 rps
  iroh         71_702 rps
  uds         120_732 rps

so, it is a bit faster than quinn over localhost with TLS, but not super much. Still, a unix domain socket has other advantages (e.g. file-level permissioning).

Frando and others added 5 commits February 28, 2026 13:46
Add irpc-uds crate implementing QUIC-over-Unix-sockets with plaintext
crypto. Uses quinn's AsyncUdpSocket trait over UnixDatagram, requiring
zero changes to irpc core. Includes tests and server-actor example.

Add irpc-bench crate comparing all four transports: local, quinn, iroh,
and UDS across sequential RPCs, concurrent RPCs, and large payloads.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Tune QUIC transport for local IPC: 1ms RTT, 16MB stream windows, 64MB send window
- Increase socket buffers to 2MB via SO_SNDBUF/SO_RCVBUF
- Remove seahash checksums (tag_len=0) since UDS is reliable
- Fix flaky concurrent clients test with larger channel buffer

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Increase MTU from 1200 to 8192 with matching EndpointConfig
  (quinn hangs above ~12K for unknown reasons, 8K is safe)
- Add pseudo-GSO: max_transmit_segments=32, split batched transmits
  into individual datagrams in poll_send
- Add batched poll_recv: receive multiple datagrams per poll call
  when data is immediately available
- Results: +17% concurrent small RPCs, +13% large payload throughput
  vs no-MTU baseline. UDS now beats quinn on all benchmarks.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Gate all irpc-uds exports, modules, and deps on cfg(unix) so the
  crate compiles as an empty lib on Windows and wasm32
- Gate irpc-bench's irpc-uds dep and UDS bench calls on cfg(unix)
- Exclude irpc-uds and irpc-bench from wasm32 CI build
- Rewrite irpc-bench to match examples/compute.rs: replace broken
  large-payload Echo benchmark with bidi streaming (Multiply), use
  n=100K default, fix clippy warnings

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Frando Frando marked this pull request as draft March 1, 2026 09:10
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.

1 participant