Skip to content

Implement JVM GC management to reduce measurement noise (issue #134)#142

Closed
Copilot wants to merge 3 commits intodevfrom
copilot/fix-issue-134
Closed

Implement JVM GC management to reduce measurement noise (issue #134)#142
Copilot wants to merge 3 commits intodevfrom
copilot/fix-issue-134

Conversation

Copy link
Contributor

Copilot AI commented Feb 26, 2026

GC pauses introduce noise spikes into sample measurements. This adds two mitigations: pre-benchmark GC triggering to drain heap pressure before I/O starts, and per-sample GC detection with automatic retake on detection.

New: GcManager

Utility class backed by the standard ManagementFactory.getGarbageCollectorMXBeans() API (no internal APIs):

  • triggerPreBenchmarkGc() — calls System.gc() before benchmark execution begins
  • getTotalGcCount() / gcOccurredSince(snapshot) — lightweight GC event detection via collection count delta
long gcCountBefore = GcManager.getTotalGcCount();
action.perform(sample);
boolean gcDetected = GcManager.gcOccurredSince(gcCountBefore);

BenchmarkRunner changes

  • execute(): calls GcManager.triggerPreBenchmarkGc() after recordStartTime(), before any I/O phase
  • runOperation(): wraps each sample in a do-while retry loop; on GC detection, undoes the per-block progress counter increments (via LongAdder.add(-numBlocks)) and retakes the sample up to MAX_GC_RETRIES = 3 times, logging each retake with retry index

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI and others added 2 commits February 26, 2026 07:23
…ing benchmarks

Co-authored-by: jamesmarkchan <6020424+jamesmarkchan@users.noreply.github.com>
…gitignore

Co-authored-by: jamesmarkchan <6020424+jamesmarkchan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix issue with incorrect disk speed reporting Implement JVM GC management to reduce measurement noise (issue #134) Feb 26, 2026
@jamesmarkchan
Copy link
Member

PR #143 looks more through so will use that.

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