code
Clone this repository
https://tangled.org/gdiazlo.tngl.sh/swim
git@tangled.org:gdiazlo.tngl.sh/swim
For self-hosted knots, clone URLs may differ based on your setup.
Add send_direct/send_to_addr API for point-to-point messaging:
- Protocol.send_direct sends to known members by node_id
- Protocol.send_to_addr sends directly to any UDP address
- Cluster.send and Cluster.send_to_addr expose the public API
Fix critical bugs discovered during benchmark testing:
- Fix infinite loop in dissemination.ml drain function
- Fix User_msg encoding losing topic/origin (encode as length-prefixed)
- Fix cluster_name mismatch causing silent message drops
Add throughput benchmarks for direct send vs gossip comparison:
- swim_throughput.ml with -direct/-gossip flags
- swim_throughput_parallel.sh for multi-node testing
- Go memberlist/serf throughput benchmarks for comparison
Results: Direct send achieves ~400 msg/s with 100% delivery vs
~2 msg/s with gossip piggybacking. Memberlist achieves ~2000 msg/s.
- Add Go benchmark harnesses for memberlist and serf
- Add OCaml benchmark harness for swim
- Add run_benchmarks.sh script with JSON output
- Change Cluster.start to use fork_daemon for clean shutdown
- Benchmarks measure convergence time, memory usage, message counts
Run with: NODES=5 DURATION=10 ./bench/run_benchmarks.sh
- Add TCP buffer pools to Protocol.t (64KB recv, 128KB decompress)
- Update LZW to work directly with Cstruct (zero-copy decompression)
- Add decompress_to_buffer and decompress_cstruct functions to LZW
- Add Cstruct-based codec functions (decode_compress_from_cstruct,
decode_push_pull_msg_cstruct)
- Update handle_tcp_connection to use buffer pools instead of per-
connection allocation
- Eliminate Cstruct.to_string conversions in hot path
Closes: swim-hrd
- Implement pure OCaml LZW decompression (LSB order, litWidth=8)
- Handle Compress_msg (type 9) in TCP connection handler
- Re-enable compression in Go memberlist (default behavior)
- Add LZW unit tests verifying Go-compatible decompression
This enables full interoperability with memberlist's default
compressed pushPull messages during Join().
- Add TCP listener creation in transport.ml and protocol.ml
- Implement pushPull message handling for TCP state sync
- Add push_pull_header and push_node_state types to Wire module
- Add encode/decode functions for pushPull messages in codec.ml
- Wire up TCP listener fiber in swim.ml Cluster.start
- Disable compression in Go interop test (memberlist uses LZ4)
This enables Go memberlist nodes to Join() to our OCaml SWIM cluster
via TCP pushPull state exchange.
- Use encryption version 1 (no PKCS7 padding) for outgoing messages
- Support decrypting both version 0 (with PKCS7) and version 1
- Add --encrypt flag to interop_test for encrypted testing
- Add test_interop_encrypted.sh for encrypted interop testing
Verified: OCaml SWIM ↔ Go memberlist encrypted ping/ack works.