Skip to content

Add opt-in memory stability soak to the perf suite - #14

Merged
cursor[bot] merged 2 commits into
mainfrom
feat/memory-stability-perf-38c4
Jul 24, 2026
Merged

Add opt-in memory stability soak to the perf suite#14
cursor[bot] merged 2 commits into
mainfrom
feat/memory-stability-perf-38c4

Conversation

@PeterBaker0

@PeterBaker0 PeterBaker0 commented Jul 24, 2026

Copy link
Copy Markdown
Owner

Summary

Adds a long-running memory stability assessment to the performance suite, gated behind the existing opt-in PROFILE=true path.

Library / probe changes (PROFILE=true only)

  • GET /_couch-auth-proxy/profile now includes process.memoryUsage() plus compact ACL cache / session resource sizes
  • POST /_couch-auth-proxy/profile/gc best-effort V8 GC when the process has --expose-gc
  • Profile compose overlay sets NODE_OPTIONS=--expose-gc (still opt-in via that overlay)

Perf harness

  • New pnpm test:perf:memory (scripts/perf-memory.sh) runs a steady-state ACL load while sampling memory
  • Trend analysis (linear fit + first/last-third median shift) budgets expected ACL-row growth and fails on unexplained heap/rss climb
  • Writes test/perf/last-memory-results.json + test/perf/last-memory-report.md
  • Default soak is 5 minutes (PERF_MEMORY_DURATION_SEC); normal pnpm test:perf is unchanged
  • Evidence report committed at docs/memory-stability.md

Soak result (this PR)

STABLE — no evidence of a memory leak

Signal Result
Duration ~303 s, 185k ops, 0% errors
heapUsed 16.48 → 14.93 MiB (Δ −1.55 MiB), slope ~0.45 KiB/s (r=0.094)
acl_rows 504 → 504 (plateau)
RSS +9.6 MiB (~48 KiB/s) with flat/declining heap — native allocator retention, not a JS leak

How to run

pnpm test:perf:memory
# or longer:
PERF_MEMORY_DURATION_SEC=600 pnpm test:perf:memory
Open in Web Open in Cursor 

cursoragent and others added 2 commits July 24, 2026 22:18
Expose process memory and ACL/session resource sizes on the PROFILE
probe, add a long-running steady-state soak with trend analysis, and
wire pnpm test:perf:memory behind the existing profile compose overlay.

Co-authored-by: Peter Baker <PeterBaker0@users.noreply.github.com>
Commit the 5-minute PROFILE soak report (stable heap, flat ACL rows)
and tighten formatBytes output for fractional rates.

Co-authored-by: Peter Baker <PeterBaker0@users.noreply.github.com>
@cursor
cursor Bot merged commit bf893d4 into main Jul 24, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants