Skip to content

Commit d5810b8

Browse files
committed
fix 4 benchmark
1 parent 0f88dce commit d5810b8

11 files changed

Lines changed: 84 additions & 72 deletions

File tree

‎.github/workflows/benchmark.yml‎

Lines changed: 36 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -3,91 +3,71 @@ name: zThread Continuous Performance Benchmark Suite
33
on:
44
push:
55
branches: [ master ]
6-
pull_request:
7-
branches: [ master ]
86
workflow_dispatch:
97

108
jobs:
11-
# Job 1: Isolated Matrix Microbenchmarks (Parallel)
12-
microbenchmarks:
9+
# Single benchmark job — runs all JMH suites sequentially
10+
benchmarks:
1311
runs-on: ubuntu-latest
1412
permissions:
15-
contents: read
16-
strategy:
17-
matrix:
18-
suite: [throughput, latency, memory, timers, eventfd, inotify, lifecycle]
19-
fail-fast: false
13+
contents: write
14+
timeout-minutes: 45
2015
steps:
2116
- uses: actions/checkout@v4
17+
with:
18+
token: ${{ secrets.AUTO_COMMIT_PAT || github.token }}
19+
2220
- name: Set up JDK 25
2321
uses: actions/setup-java@v5
2422
with:
2523
java-version: '25'
2624
distribution: 'temurin'
27-
- name: Run Microbenchmark Suite
28-
run: ./mvnw test -pl zthread-benchmark --also-make -DskipTests=false -Dbenchmark.suite=${{ matrix.suite }}
25+
26+
- name: Compile Benchmark Module
27+
run: ./mvnw compile test-compile -pl zthread-benchmark --also-make -DskipTests=true
28+
29+
- name: Run JMH Microbenchmarks
30+
run: |
31+
for suite in throughput eventfd inotify timers; do
32+
echo "::group::Running $suite benchmarks"
33+
./mvnw test -pl zthread-benchmark --also-make -DskipTests=false -Dbenchmark.suite=$suite || true
34+
echo "::endgroup::"
35+
done
2936
continue-on-error: true
30-
- name: Upload Benchmark JSON Artifact
31-
uses: actions/upload-artifact@v4
32-
with:
33-
name: benchmark-${{ matrix.suite }}
34-
path: zthread-benchmark/target/benchmark-results/*.json
3537

36-
# Job 2: Heavy Application & Scalability Benchmarks (Sequential / Dedicated)
37-
application-benchmarks:
38-
runs-on: ubuntu-latest
39-
permissions:
40-
contents: read
41-
needs: microbenchmarks
42-
steps:
43-
- uses: actions/checkout@v4
44-
- name: Set up JDK 25 & Benchmark Tools
45-
uses: actions/setup-java@v5
46-
with:
47-
java-version: '25'
48-
distribution: 'temurin'
49-
- name: Install Network Benchmark Harnesses
50-
run: sudo apt-get update && sudo apt-get install -y wrk sysstat iperf
51-
- name: Run Sequential Heavy Benchmarks (Socket, HTTP, WebSocket, Scaling, Idle)
38+
- name: Run Scaling & Idle Benchmarks
5239
run: |
53-
./mvnw test -pl zthread-benchmark --also-make -DskipTests=false -Dbenchmark.suite=socket
54-
./mvnw test -pl zthread-benchmark --also-make -DskipTests=false -Dbenchmark.suite=http
55-
./mvnw test -pl zthread-benchmark --also-make -DskipTests=false -Dbenchmark.suite=websocket
56-
./mvnw test -pl zthread-benchmark --also-make -DskipTests=false -Dbenchmark.suite=scaling
57-
./mvnw test -pl zthread-benchmark --also-make -DskipTests=false -Dbenchmark.suite=idle
40+
for suite in scaling idle; do
41+
echo "::group::Running $suite benchmarks"
42+
./mvnw test -pl zthread-benchmark --also-make -DskipTests=false -Dbenchmark.suite=$suite || true
43+
echo "::endgroup::"
44+
done
5845
continue-on-error: true
59-
- name: Upload Heavy Benchmark Artifacts
46+
47+
- name: Upload Benchmark Results
6048
uses: actions/upload-artifact@v4
49+
if: always()
6150
with:
62-
name: benchmark-heavy
51+
name: benchmark-results
6352
path: zthread-benchmark/target/benchmark-results/*.json
53+
if-no-files-found: ignore
6454

65-
# Job 3: Generate Dashboard, Visual Charts & Update README
66-
dashboard-update:
67-
runs-on: ubuntu-latest
68-
permissions:
69-
contents: write
70-
needs: [microbenchmarks, application-benchmarks]
71-
if: github.ref == 'refs/heads/master'
72-
steps:
73-
- uses: actions/checkout@v4
74-
with:
75-
token: ${{ secrets.AUTO_COMMIT_PAT || github.token }}
7655
- name: Set up Python
7756
uses: actions/setup-python@v5
7857
with:
7958
python-version: '3.12'
59+
8060
- name: Install Charting Dependencies
8161
run: pip install matplotlib pandas seaborn tabulate
82-
- name: Download All Benchmark Artifacts
83-
uses: actions/download-artifact@v4
84-
with:
85-
path: target/benchmark-results/
86-
merge-multiple: true
62+
8763
- name: Generate SVG Charts and Update README.md
8864
run: python3 scripts/generate_report.py
65+
if: github.ref == 'refs/heads/master'
66+
continue-on-error: true
67+
8968
- name: Commit & Push Updated README & Benchmark Assets
69+
if: github.ref == 'refs/heads/master'
9070
uses: stefanzweifel/git-auto-commit-action@v5
9171
with:
9272
commit_message: "chrono(benchmark): auto-update performance dashboard & SVG charts"
93-
file_pattern: "README.md assets/benchmarks/* target/benchmark-results/*.json"
73+
file_pattern: "README.md assets/benchmarks/* zthread-benchmark/target/benchmark-results/*.json"

‎zthread-benchmark/src/main/java/io/github/namanoncode/zthread/benchmark/eventfd/SignalBenchmark.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
@State(Scope.Benchmark)
1111
@BenchmarkMode(Mode.Throughput)
1212
@OutputTimeUnit(TimeUnit.SECONDS)
13-
@Warmup(iterations = 2, time = 2)
14-
@Measurement(iterations = 3, time = 3)
13+
@Warmup(iterations = 2, time = 1)
14+
@Measurement(iterations = 3, time = 2)
1515
@Fork(value = 1, jvmArgsAppend = {"--enable-native-access=ALL-UNNAMED", "-XX:+UseZGC"})
1616
public class SignalBenchmark {
1717

‎zthread-benchmark/src/main/java/io/github/namanoncode/zthread/benchmark/inotify/FileWatchBenchmark.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
@State(Scope.Benchmark)
1313
@BenchmarkMode(Mode.Throughput)
1414
@OutputTimeUnit(TimeUnit.SECONDS)
15-
@Warmup(iterations = 2, time = 2)
16-
@Measurement(iterations = 3, time = 3)
15+
@Warmup(iterations = 2, time = 1)
16+
@Measurement(iterations = 3, time = 2)
1717
@Fork(value = 1, jvmArgsAppend = {"--enable-native-access=ALL-UNNAMED", "-XX:+UseZGC"})
1818
public class FileWatchBenchmark {
1919

‎zthread-benchmark/src/main/java/io/github/namanoncode/zthread/benchmark/scaling/ThroughputLatencyBenchmark.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212
@BenchmarkMode(Mode.Throughput)
1313
@OutputTimeUnit(TimeUnit.SECONDS)
14-
@Warmup(iterations = 3, time = 2, timeUnit = TimeUnit.SECONDS)
15-
@Measurement(iterations = 5, time = 2, timeUnit = TimeUnit.SECONDS)
14+
@Warmup(iterations = 2, time = 1, timeUnit = TimeUnit.SECONDS)
15+
@Measurement(iterations = 3, time = 1, timeUnit = TimeUnit.SECONDS)
1616
@Fork(1)
1717
@State(Scope.Benchmark)
1818
public class ThroughputLatencyBenchmark {

‎zthread-benchmark/src/main/java/io/github/namanoncode/zthread/benchmark/throughput/BurstTrafficBenchmark.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212

1313
@BenchmarkMode(Mode.SingleShotTime)
1414
@OutputTimeUnit(TimeUnit.MILLISECONDS)
15-
@Warmup(iterations = 3, batchSize = 1)
16-
@Measurement(iterations = 5, batchSize = 1)
15+
@Warmup(iterations = 2, batchSize = 1)
16+
@Measurement(iterations = 3, batchSize = 1)
1717
@Fork(1)
1818
@State(Scope.Benchmark)
1919
public class BurstTrafficBenchmark {

‎zthread-benchmark/src/main/java/io/github/namanoncode/zthread/benchmark/throughput/MpmcEventBenchmark.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
@State(Scope.Benchmark)
1515
@BenchmarkMode(Mode.Throughput)
1616
@OutputTimeUnit(TimeUnit.SECONDS)
17-
@Warmup(iterations = 3, time = 2)
18-
@Measurement(iterations = 5, time = 3)
17+
@Warmup(iterations = 2, time = 1)
18+
@Measurement(iterations = 3, time = 2)
1919
@Fork(value = 1, jvmArgsAppend = {"--enable-native-access=ALL-UNNAMED", "-XX:+UseZGC"})
2020
public class MpmcEventBenchmark {
2121

‎zthread-benchmark/src/main/java/io/github/namanoncode/zthread/benchmark/throughput/MpscEventBenchmark.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
@State(Scope.Benchmark)
1414
@BenchmarkMode(Mode.Throughput)
1515
@OutputTimeUnit(TimeUnit.SECONDS)
16-
@Warmup(iterations = 3, time = 2)
17-
@Measurement(iterations = 5, time = 3)
16+
@Warmup(iterations = 2, time = 1)
17+
@Measurement(iterations = 3, time = 2)
1818
@Fork(value = 1, jvmArgsAppend = {"--enable-native-access=ALL-UNNAMED", "-XX:+UseZGC"})
1919
public class MpscEventBenchmark {
2020

‎zthread-benchmark/src/main/java/io/github/namanoncode/zthread/benchmark/throughput/SpscEventBenchmark.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
@State(Scope.Benchmark)
1414
@BenchmarkMode(Mode.Throughput)
1515
@OutputTimeUnit(TimeUnit.SECONDS)
16-
@Warmup(iterations = 3, time = 2)
17-
@Measurement(iterations = 5, time = 3)
16+
@Warmup(iterations = 2, time = 1)
17+
@Measurement(iterations = 3, time = 2)
1818
@Fork(value = 1, jvmArgsAppend = {"--enable-native-access=ALL-UNNAMED", "-XX:+UseZGC"})
1919
public class SpscEventBenchmark {
2020

‎zthread-benchmark/src/main/java/io/github/namanoncode/zthread/benchmark/timers/TimerExecutionBenchmark.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
@State(Scope.Benchmark)
1414
@BenchmarkMode(Mode.Throughput)
1515
@OutputTimeUnit(TimeUnit.SECONDS)
16-
@Warmup(iterations = 3, time = 2)
17-
@Measurement(iterations = 5, time = 3)
16+
@Warmup(iterations = 2, time = 1)
17+
@Measurement(iterations = 3, time = 2)
1818
@Fork(value = 1, jvmArgsAppend = {"--enable-native-access=ALL-UNNAMED", "-XX:+UseZGC"})
1919
public class TimerExecutionBenchmark {
2020

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<configuration>
2+
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
3+
<encoder>
4+
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
5+
</encoder>
6+
</appender>
7+
8+
<!-- Suppress verbose Netty DEBUG logging (including the caught Unsafe exception on JDK 25) -->
9+
<logger name="io.netty" level="WARN" />
10+
<logger name="io.vertx" level="WARN" />
11+
<logger name="io.github.namanoncode.zthread" level="INFO" />
12+
13+
<root level="WARN">
14+
<appender-ref ref="STDOUT" />
15+
</root>
16+
</configuration>

0 commit comments

Comments
 (0)