memory of a public node with 1000 connections: measured, GOMEMLIMIT in the manifest

cmd/allmende-conns opens many small libp2p clients to one node. A real --public node: 35 MB idle, 131 MB with 1000 connections, 156 MB at the peak with 100 listings flooded to all of them; the limit refused the 1001st. The StatefulSet sets GOMEMLIMIT=400MiB under its 512Mi limit as a safety net.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AeFqV96dVeBX94inzcgZKw
This commit is contained in:
2026-11-19 00:58:45 +01:00
co-authored by Claude Sonnet 5.5
parent 59973cbf43
commit 6e37a2c654
4 changed files with 138 additions and 6 deletions
+6 -4
View File
@@ -150,9 +150,11 @@ starting a design-heavy item; see "Working with the owner".
access exists. Listings already have an `images` field of hashes.
- **Recovering listings onto an empty database** (after losing the data
directory but not the phrase).
- **Check a public node's memory under load.** `--public` nodes now accept
1000 inbound connections (`--max-conns`); nobody has measured a node holding
that many against the 512 MiB pod limit.
- **Public node memory** was measured (`cmd/allmende-conns`): 1000 inbound
connections cost about 130 MB, 156 MB at the peak with 100 listings flooded
to all of them, against the 512 MiB pod limit; the manifest sets
`GOMEMLIMIT=400MiB` as a safety net. Not measured: real peers (DHT queries,
relayed streams) and a node with a large database.
- **What the abuse limits do not cover** (`internal/p2p/guard.go`, `ipgate.go`,
`internal/api/ratelimit.go`): attackers with many real addresses, valid but
unwanted records under the limits, and bans are per node and not shared
@@ -244,7 +246,7 @@ make image # build and push the container image (clean tree only)
| `internal/inbox` | the owner's conversations, replies, block |
| `internal/api` | HTTP API (public reads, relay, admin); `ratelimit.go` (per-client limit, trusted proxies) |
| `internal/places`, `internal/jcs`, `internal/pow` | place names, canonical JSON, hashcash (`pow.Mine`, the fast miner) |
| `cmd/allmende-sim`, `cmd/allmende-load` | network simulator; load and mining-time tool |
| `cmd/allmende-sim`, `cmd/allmende-load`, `cmd/allmende-conns` | network simulator; load and mining-time tool; holds many connections to one node to measure its memory |
| `web/` | TypeScript UI (embedded), tests, build; `web/static/places.tsv` is generated |
| `k8s/`, `nix/`, `Dockerfile` | deployment |
| `scripts/e2e.sh`, `scripts/e2e/` | end-to-end with real binaries and jsdom |