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
| flag | default | meaning |
|---|---|---|
-origins | 1000 | number of origin instances (M) |
-gateways | 500 | number of gateway instances (N) |
-subset | 20 | subset 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
| File | What |
|---|---|
connpool/pool.go | keep-alive pool: Get/Put, Created/Reused/Closed, idle TTL |
connpool/looppools.go | per-event-loop pools (lock-free, no handoff) |
connpool/ring.go | Van der Corput sequence, the distribution ring, subsetting, coverage, hash-mod baseline |
cmd/churnsim | the no-network demonstration of all three results |
See GUIDE.md for the full deep dive.