Skip to content

Benchmark compaction against the JE cleaner - #65

Merged
venkat1701 merged 7 commits into
mainfrom
feat/bench-compaction-ratio
Oct 11, 2026
Merged

venkat1701 merged 7 commits into
mainfrom
feat/bench-compaction-ratio

Conversation

@venkat1701

Copy link
Copy Markdown
Collaborator

Closes #60

Adds a compaction phase after the churn, for both stores:

  1. disk.churned is recorded at a reopen, so it still means "after the deletes".
  2. compaction.baseline: 10 s of single-update commits every 20 ms on a fixed schedule, with latency measured from the scheduled time.
  3. compaction: the same, with a full compaction starting 1 s in. The window runs until the compaction finishes, so a long pass can't fall outside it.
  4. disk.compacted: bytes on disk after a clean shutdown.

HStore calls StorageEngine.compact(). HyperGraphDB runs JE's cleanLog() until it cleans nothing, then forces a checkpoint so the cleaned files get deleted.

The report shows both windows in the latency table, plus compaction time and space reclaimed in the Resources table. Reclaimed space is the first measure where more is better, so its ratio is flipped. It can also be negative, which the report now prints properly.

It also adds --compaction-live-ratio and --pages-per-segment (COMPACTION_LIVE_RATIO and PAGES_PER_SEGMENT in run.sh) for HStore.

Smoke runs at scale 1, async, one run each, on a loaded machine:

HStore HyperGraphDB
commit p99 without compaction 7 to 22 ms 5 to 7 ms
commit p99 during compaction, default segments 6.6 s 5 ms
commit p99 during compaction, 16 MiB segments 2.4 to 4.1 s 6 to 35 ms
compaction time, 16 MiB segments 3.1 to 5.3 s 12 ms to 3.8 s
disk reclaimed, 16 MiB segments 541 to 551 MiB -0.8 to 15 MiB
disk after compaction 80 to 88 MiB 180 to 183 MiB

So HStore gets far more space back, but stops commits for the whole pass, while JE keeps committing. That's #50, now measured by the benchmark.

Tested:

  • each commit compiles on its own; full ./mvnw install passes
  • old result files render unchanged
  • RUNS=1 PAGES_PER_SEGMENT=1024 benchmarks/run.sh runs end to end
  • the crash child gets the new options

--compaction-live-ratio and --pages-per-segment set the matching engine
options for HStore runs, so compaction behaviour can be compared across
settings.
HStore calls StorageEngine.compact. JE runs cleanLog until it cleans
nothing and then forces a checkpoint, which deletes the cleaned files.
After the churn, two 10 s windows of single-update commits on a fixed
schedule: one without compaction and one with a full compaction starting
1 s in. disk.churned is now recorded at a reopen before them, and
disk.compacted at the end.
Reclaimed space is the first measure where more is better, so its ratio
is inverted, and negative sizes are printed as such.
HStore deletes a retired segment only once no older reader can need it, which
often happens after compact() returns. Measuring the disk while open, right
after the window, missed that space. Both sides of the figure now come from a
reopen. The delay before compaction now loops until its deadline, and the two
fixed-rate windows are left out of the main table, where their ratio only
showed the schedule.
@venkat1701
venkat1701 merged commit b5fe1d2 into main Oct 11, 2026
@venkat1701
venkat1701 deleted the feat/bench-compaction-ratio branch October 11, 2026 09:11
@venkat1701
venkat1701 restored the feat/bench-compaction-ratio branch October 11, 2026 09:12
@venkat1701
venkat1701 deleted the feat/bench-compaction-ratio branch October 11, 2026 09:13
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.

Add a compaction workload to the benchmark

1 participant