Skip to content

#134 baseline with ZGC, sample retry on gc, gc hint options#143

Merged
jamesmarkchan merged 21 commits intodevfrom
copilot/configure-gen-zgc-sample
Mar 2, 2026
Merged

#134 baseline with ZGC, sample retry on gc, gc hint options#143
jamesmarkchan merged 21 commits intodevfrom
copilot/configure-gen-zgc-sample

Conversation

Copy link
Contributor

Copilot AI commented Feb 26, 2026

  • Create GcDetector.java - utility class to detect GC events via GarbageCollectorMXBean notifications
  • Modify BenchmarkRunner.java - add GC detection and sample retry logic (up to MAX_GC_RETRIES=3)
  • Fix progress over-counting on GC retries (subtract numBlocks before each retry attempt)
  • Modify App.java - gcRetryEnabled defaults to false (opt-in, not opt-out)
  • Modify BenchmarkConfig.java - add gcRetryEnabled field (primitive boolean)
  • Update nbproject/project.properties - set run.jvmargs=-XX:+UseZGC to enable Generational ZGC
  • Add --gc-retry CLI option to RunBenchmarkCommand.java
  • Fix GcDetector.getGlobalGcCount() to work with all GC collectors (not just ZGC "Cycles" beans)

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

- Add GcDetector.java: detects JVM GC events via GarbageCollectorMXBean notifications
- Modify BenchmarkRunner: retry sample up to MAX_GC_RETRIES (3) when GC detected
- Add gcRetryEnabled option to App, BenchmarkConfig, and RunBenchmarkCommand (--gc-retry)
- Set run.jvmargs=-XX:+UseZGC in project.properties to enable Generational ZGC

Co-authored-by: jamesmarkchan <6020424+jamesmarkchan@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement solution for issue #134 on gen zgc configuration Implement Generational ZGC configuration and GC-aware sample retry (#134) Feb 26, 2026
@jamesmarkchan
Copy link
Member

I've updated the issue description

@jamesmarkchan jamesmarkchan changed the title Implement Generational ZGC configuration and GC-aware sample retry (#134) baseline ZGC GC-aware sample retry (#134) Mar 1, 2026
@jamesmarkchan jamesmarkchan changed the title baseline ZGC GC-aware sample retry (#134) #134 baseline with ZGC, sample retry on gc, gc hint options Mar 1, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to reduce benchmark noise caused by GC pauses by (1) running with ZGC by default in project/packaging configs and (2) adding an opt-in mechanism to detect GC during a sample and retry that sample.

Changes:

  • Added a GcDetector that listens for GC JMX notifications, plus a triggerAndWait() helper for GC “hinting”.
  • Added per-sample GC-detection retry logic to BenchmarkRunner behind a new gcRetryEnabled flag (wired through CLI + GUI + persisted config).
  • Updated run/packaging configs (NetBeans, Ant/jpackage, Debian wrapper) to pass -XX:+UseZGC; added a GitHub Actions DEB build workflow.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/jdiskmark/RunBenchmarkCommand.java Adds --gc-retry / -g CLI flag and persists it into App.gcRetryEnabled.
src/jdiskmark/MainFrame.java Adds GUI menu toggles for GC hints and GC retry, persisted via App.saveConfig().
src/jdiskmark/MainFrame.form NetBeans form updates for the new menu items.
src/jdiskmark/GcDetector.java New class to detect GC events + provide GC hinting helper (triggerAndWait()).
src/jdiskmark/BenchmarkRunner.java Adds GC-aware retry loop and optional GC hinting calls around benchmark phases.
src/jdiskmark/BenchmarkConfig.java Adds gcRetryEnabled and gcHintsEnabled to the benchmark config snapshot.
src/jdiskmark/App.java Adds persisted config keys for GC retry/hints, and injects them into BenchmarkConfig.
pkg/ubuntu/symlink/postinst Enhances DEB post-install to create a desktop entry and update desktop database.
nbproject/project.properties Sets NetBeans run JVM args to -XX:+UseZGC.
build.xml Adds --java-options for jpackage/DEB launcher and sets a default jvm.run.options=-XX:+UseZGC.
.github/workflows/linux-build.yml New workflow to build/upload DEB artifacts using Ant on Ubuntu.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

jamesmarkchan and others added 2 commits March 1, 2026 10:03
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
)

- Default gcRetryEnabled to false (was incorrectly true)
- Compensate progress counters on GC retry: subtract config.numBlocks
  from writeUnitsComplete/readUnitsComplete before each retry to cancel
  block-level increments from the failed attempt
- Fix getGlobalGcCount() to count all GC collectors when no ZGC
  "Cycles" beans are present, avoiding 2s timeout on G1/Parallel GC

Co-authored-by: jamesmarkchan <6020424+jamesmarkchan@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jamesmarkchan jamesmarkchan marked this pull request as ready for review March 2, 2026 02:04
@jamesmarkchan jamesmarkchan merged commit 12827d4 into dev Mar 2, 2026
1 check passed
@jamesmarkchan jamesmarkchan deleted the copilot/configure-gen-zgc-sample branch March 2, 2026 02: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.

3 participants