github psqlmaster/gorgona gorgonad-v3.5.9

one hour ago

What's Changed

  • docs+config: finalize the multi-core sharding cycle (epoll reactor docs, max_clients=1024) by @psqlmaster in #22

Full Changelog: gorgonad-v3.5.8...gorgonad-v3.5.9

gorgonad v3.5.9

Headline: the single-threaded select() reactor is gone. gorgonad now runs a connection
thread on epoll plus M core workers executing commands against hash-routed storage
shards, and per-key hash-chain determinism is proven by a formal permutation-invariance
gate. Client goes to v3.1.6 unchanged; one client-side ACK race fix ships in common/.

Highlights

  • epoll reactor (8f894bb): level-triggered with a per-slot interest cache, accept
    drain loop, lazy registration of outbound peer sockets.
  • Dynamic slot pool (b708c65): free list + fd->slot reverse map, RLIMIT-aware
    ceiling - 10008 concurrent connections measured on a bed node (was a hard cap of 1024).
  • conn/core thread split and sharding (9c4cdf1, 7799764, 7a0e916): typed event
    queues per shard, storage mutations routed by xxh3_64(pubkey_hash) % M, fixed lock
    order SHARD -> SRV, shadow subscriber snapshots, AUTH applied inline on the conn
    thread, deferred close so only the conn thread frees socket state.
  • Per-worker snowflake streams and atomic CAS-max watermarks (b175a36): lock-free
    unique IDs across M workers, chronological ID order preserved.
  • Storage API perimeter and shard contexts (de7119e..eb33237): the g_storage
    symbol is gone; every iteration site is a shard loop, so the compiler enforces the
    multi-store layout.
  • bench_send tooling (9be7f3e, 61213eb, 007d6ec): persistent-connection load
    generator (40x the CLI rate), journal capture and shuffled replay for correctness gates.
  • Client ACK race fix (e972ef0): unsolicited L2 gossip (MGMT/PEX) frames are now
    skipped while waiting for the send acknowledgement - closes a long-standing REJECT race.
  • OpenWrt cross-build fixed (e2685f9): events.c was missing from both SDK source lists.

Commits (25)

bc54d8e fix(gorgonad): warning-free key resolution test buffers
de7119e feat(gorgonad): run one mesh bed node with disk-backed storage
c09739c feat(gorgonad): introduce connection context for subscribers and sockets
e62d0d6 feat(gorgonad): introduce mesh context for peers and repl ring
de6725d feat(gorgonad): introduce storage context for recipient chains
c1fba9e feat(gorgonad): route recipient access through storage api perimeter
ebba034 feat(gorgonad): typed event queue between framing and storage
a95249a feat(gorgonad): buffered frame reader with slot liveness guards
9c4cdf1 feat(gorgonad): split connection and core layers into two threads
8f894bb feat(gorgonad): epoll reactor with lazy interest registration
bdb0ee4 feat(gorgonad): multi-channel concurrent write and live-reader mesh test
b708c65 feat(gorgonad): dynamic slot pool with free-list and fd reverse map
d9a1c43 feat(gorgonad): shard storage context with hash-routed recipient access
e2685f9 fix(build): add events.c to OpenWrt cross-build source lists
eb33237 feat(gorgonad): convert every recipient iteration site to shard loops
9be7f3e feat(gorgonad): bench_send load generator with journal capture and shuffled replay
e972ef0 fix(gorgona): skip unsolicited mesh gossip frames while waiting for send ACK
7799764 feat(gorgonad): per-shard event queues and core worker pool
b175a36 feat(gorgonad): per-worker snowflake streams and atomic shard watermarks
7a0e916 feat(gorgonad): shard-parallel dispatch with shadow subscriber contexts
61213eb feat(gorgonad): replay hold-open and timestamp refresh for ingest benchmarks
007d6ec feat(gorgonad): bench_send prebuilt binary for load harnesses
f8994bb fix(gorgonad): correct Vacuum Check Interval label in status output
ae2d747 feat(gorgonad): raise shipped max_clients to 1024 and document dynamic slot ceiling
5f768ef docs(readme): refresh server and client architecture for the epoll sharded reactor

Verification

Full regression on the 5-node Docker bed, green at SHARDS=1 and SHARDS=4: mesh delivery,
hash check (identical id+hash dumps on all nodes), split-brain heal, load test x3,
concurrent multi-channel with live readers, scale test 10008 connections.
Permutation-invariance gate: 100-frame journals replayed in shuffled orders produce
byte-identical dumps. TSan clean under mixed load at M=4. Unit tests pass; binaries
build warning-free (deb/rpm/OpenWrt).

Benchmarks (single node, disk-backed REPL ingest)

Workload (alerts/sec) select 3.5.8 epoll M=1 epoll M=4
Calm ingest: 8 connections x 2.5k alerts, full drain 4915 4871 4843
Write flood, 16 connections: sustained rate during backlog drain (median) 78 193 624
Write flood, 16 connections: peak second 622 3700 8932
Concurrent connections (scale test) hard cap 1024 10008 10008

Methodology: same-host runs, disk-backed storage. Calm ingest is generator-bound -
all three variants drain identically, the old reactor is not slower there. The flood
rows measure server-side ingest from log timestamps while a write backlog drains:
the single-threaded select loop sustains 78 alerts/s with a 74-second tail, four
shard workers clear the same backlog in seconds and hold ~8x the sustained rate
(peak second: 8932 vs 622). Frames are counted one-to-one as alerts.

Write-up: https://sqlmaster.mooo.com/en/posts/from-select-to-multi-core-refactoring-the-gorgona-server-without-losing-hash-chain-determinism/

Don't miss a new gorgona release

NewReleases is sending notifications on new releases.