Stability/soak testing infrastructure #6

Open
opened 2026-08-07 14:22:11 +00:00 by hum3 · 0 comments
Owner

Overview

Add comprehensive stability and soak testing infrastructure to go-postgres, covering native, WASM, and container environments.

Implemented (task/WTstable branch)

Packages

  • memcheck/ — Memory monitor package with Stats, Monitor, FormatBytes. WASM build tag sets debug.SetMemoryLimit(900MB). Reusable by gobank.
  • soakwork/ — Reusable workload engine: interest-calculation simulation with configurable batch size, delete threshold, and reporting interval.
  • translate_cache.go — Query translation cache (FIFO eviction, default 1000 entries). TranslateCached() wraps Translate().

Test infrastructure

  • soak_test.go — Native soak test (TestSoakNative), file-backed DB, configurable via SOAK_DURATION env var (default 5m), 512MB memory limit.
  • translate_bench_test.go — Benchmarks for tokenizer, translation passes, full translate, and cached translate.
  • cmd/soakwasm/ — Browser WASM soak test with discovery (run until OOM) and sustained (with deletion) modes.
  • cmd/soakserve/ — HTTP server for the WASM soak test.
  • Containerfile — Container image for long-running soak tests (distroless, pure Go).

Taskfile tasks

bench, test:soak, test:soak:long, soak:wasm:build, soak:wasm, container:build, container:run, container:run:oom

Key results

Benchmark ns/op B/op allocs/op
Translate SimpleSelect 109,740 112,597 191
Translate ComplexDDL 224,399 234,760 290
Tokenize 10,788 6,624 54
TranslateTokens (no tokenizer) 79,970 105,706 132
TranslateCached (hit) 70 0 0

Cache provides ~1500x speedup with zero allocations on hit.

10s native soak: 802KB final alloc, 44 GC cycles — memory is well-controlled.

Remaining work

  • GCP Cloud Run Jobs deployment tasks
  • WASM browser ceiling discovery (requires manual browser testing)
  • Integration of TranslateCached into the driver (behind a flag or as default)
  • See #gobank issue for memcheck adoption

Migrated from Codeberg: originally #6, opened 2026-03-20.

## Overview Add comprehensive stability and soak testing infrastructure to go-postgres, covering native, WASM, and container environments. ## Implemented (task/WTstable branch) ### Packages - **`memcheck/`** — Memory monitor package with `Stats`, `Monitor`, `FormatBytes`. WASM build tag sets `debug.SetMemoryLimit(900MB)`. Reusable by gobank. - **`soakwork/`** — Reusable workload engine: interest-calculation simulation with configurable batch size, delete threshold, and reporting interval. - **`translate_cache.go`** — Query translation cache (FIFO eviction, default 1000 entries). `TranslateCached()` wraps `Translate()`. ### Test infrastructure - **`soak_test.go`** — Native soak test (`TestSoakNative`), file-backed DB, configurable via `SOAK_DURATION` env var (default 5m), 512MB memory limit. - **`translate_bench_test.go`** — Benchmarks for tokenizer, translation passes, full translate, and cached translate. - **`cmd/soakwasm/`** — Browser WASM soak test with discovery (run until OOM) and sustained (with deletion) modes. - **`cmd/soakserve/`** — HTTP server for the WASM soak test. - **`Containerfile`** — Container image for long-running soak tests (distroless, pure Go). ### Taskfile tasks `bench`, `test:soak`, `test:soak:long`, `soak:wasm:build`, `soak:wasm`, `container:build`, `container:run`, `container:run:oom` ## Key results | Benchmark | ns/op | B/op | allocs/op | |-----------|------:|-----:|----------:| | Translate SimpleSelect | 109,740 | 112,597 | 191 | | Translate ComplexDDL | 224,399 | 234,760 | 290 | | Tokenize | 10,788 | 6,624 | 54 | | TranslateTokens (no tokenizer) | 79,970 | 105,706 | 132 | | TranslateCached (hit) | 70 | 0 | 0 | Cache provides ~1500x speedup with zero allocations on hit. 10s native soak: 802KB final alloc, 44 GC cycles — memory is well-controlled. ## Remaining work - GCP Cloud Run Jobs deployment tasks - WASM browser ceiling discovery (requires manual browser testing) - Integration of `TranslateCached` into the driver (behind a flag or as default) - See #gobank issue for memcheck adoption --- *Migrated from Codeberg: originally [#6](https://codeberg.org/hum3/go-postgres/issues/6), opened 2026-03-20.*
Sign in to join this conversation.
No labels
OnDemand
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
hum3/go-postgres#6
No description provided.