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 missing 'fmt' dependency
- Move test/benchmark dependencies (eio_main, qcheck, alcotest) to with-test
- Update version constraints to match environment (mirage-crypto >= 2.0, etc.)
- Remove unused eio_main from library link phase
- Add max_gossip_queue_depth to config (default 5000)
- Enforce limit in Dissemination.enqueue by dropping oldest items (ring buffer)
- Prevents unbounded memory growth when broadcast rate exceeds gossip bandwidth
- codec: avoid creating 2KB temp buffers for every piggybacked message in encode_packet
- types: replace Printf.sprintf with String.concat for User_msg encoding
- buffer_pool: remove unnecessary memset 0 on acquire (buffers are overwritten or viewed)
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