Repository navigation
Measure purge writer-wait from a separate process - #34
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
Testing
Full suite green on SQLite and PostgreSQL, rubocop clean; CI covers MySQL.
REEVE_PURGE_SIZE=20000 bundle exec rspec --tag benchmark_large spec/reeve/audit/chain/benchmark_spec.rb -e purgespasses and prints the writer's latency alone and during the purge.DB=postgresql DB_HOST=/tmp.REEVE_PURGE_SIZEfor the full million (several minutes per engine) and compare with SC-004 in the retention spec.