Skip to content

Measure purge writer-wait from a separate process - #34

Merged
vicmaster merged 2 commits into
mainfrom
006-purge-writer-wait
Nov 5, 2026
Merged

vicmaster merged 2 commits into
mainfrom
006-purge-writer-wait

Conversation

@vicmaster

Copy link
Copy Markdown
Owner

Changes

The purge benchmark now measures writers from a separate process instead of a thread in the purge's own process, so Ruby's lock between threads no longer inflates the numbers. On a purge of a million entries, writers on SQLite and PostgreSQL do not queue behind it: typical and p99 write times stay close to what the writer sees alone. The new figures replace the old ones in the retention spec. No behavior change in the gem; benchmark and spec record only.

  • MySQL is still unmeasured: no local server, and CI does not run this benchmark.

Testing

Full suite green on SQLite and PostgreSQL, rubocop clean; CI covers MySQL.

  1. REEVE_PURGE_SIZE=20000 bundle exec rspec --tag benchmark_large spec/reeve/audit/chain/benchmark_spec.rb -e purges passes and prints the writer's latency alone and during the purge.
  2. Repeat with DB=postgresql DB_HOST=/tmp.
  3. Optionally run without REEVE_PURGE_SIZE for the full million (several minutes per engine) and compare with SC-004 in the retention spec.

The in-process writer thread shared Ruby's GVL with the purge's HMAC work, so its slowest writes
mixed GVL waits with database waits. The writer is now a spawned process; the example reports
its latency alone and during the purge, and fails fast on any writer fault.
@vicmaster
vicmaster merged commit faf74e1 into main Nov 5, 2026
12 checks passed
@vicmaster
vicmaster deleted the 006-purge-writer-wait branch November 5, 2026 20:05
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.

1 participant