gw-04 — Execution

Prerequisites

  • Go ≥ 1.25 (stdlib only, offline).

One-shot

cd gw-04-connection-management && bash scripts/verify.sh   # tests + churnsim demo

Per-language workflow (Go)

cd gw-04-connection-management/src/go
go test -race -count=1 ./...        # pool, per-loop, subsetting tests
go run ./cmd/churnsim -origins 1000 -gateways 500 -subset 20

churnsim flags

flagdefaultmeaning
-origins1000number of origin instances (M)
-gateways500number of gateway instances (N)
-subset20subset size per gateway

Output shows: the N×M → N×subset connection reduction, coverage balance (min/p50/max vs ideal), and stability (ring vs hash-mod) when one origin leaves.

Package map

FileWhat
connpool/pool.gokeep-alive pool: Get/Put, Created/Reused/Closed, idle TTL
connpool/looppools.goper-event-loop pools (lock-free, no handoff)
connpool/ring.goVan der Corput sequence, the distribution ring, subsetting, coverage, hash-mod baseline
cmd/churnsimthe no-network demonstration of all three results

See GUIDE.md for the full deep dive.