Skip to content

Commit c2771b7

Browse files
authored
Workflow for running benchmarks weekly (#3052)
1 parent 345e0f9 commit c2771b7

File tree

3 files changed

+84
-19
lines changed

3 files changed

+84
-19
lines changed

.github/workflows/benchmarks.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Benchmarks
2+
on:
3+
schedule:
4+
- cron: '0 1 * * *' # nightly build
5+
workflow_dispatch:
6+
7+
jobs:
8+
9+
benchmark:
10+
name: Build and Test
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout project
14+
uses: actions/checkout@v4
15+
- name: Set Java up in the runner
16+
uses: actions/setup-java@v4
17+
with:
18+
java-version: '8'
19+
distribution: 'temurin'
20+
cache: 'maven'
21+
- name: Setup Maven
22+
23+
with:
24+
java-version: 8
25+
- name: Install missing dependencies to container
26+
run: |
27+
sudo apt update
28+
sudo apt install -y stunnel make git gcc
29+
- name: Maven offline
30+
run: |
31+
mvn -q dependency:go-offline
32+
- name: Clean environment
33+
run: |
34+
make cleanup
35+
env:
36+
JVM_OPTS: -Xmx3200m
37+
TERM: dumb
38+
- name: Start servers
39+
run: |
40+
make start
41+
- name: Run benchmarks
42+
run: |
43+
mvn -Pjmh clean test
44+
env:
45+
JVM_OPTS: -Xmx3200m
46+
TERM: dumb
47+
# Download previous benchmark result from cache (if exists)
48+
- name: Download previous benchmark data
49+
uses: actions/cache@v4
50+
with:
51+
path: ./cache
52+
key: ${{ runner.os }}-benchmark
53+
# Run `github-action-benchmark` action
54+
- name: Store benchmark result
55+
uses: benchmark-action/github-action-benchmark@v1
56+
with:
57+
# What benchmark tool the output.txt came from
58+
tool: 'jmh'
59+
# Where the output from the benchmark tool is stored
60+
output-file-path: benchmark.log
61+
# Where the previous data file is stored
62+
external-data-json-path: ./cache/benchmark.log
63+
# Workflow will fail when an alert happens
64+
fail-on-alert: true
65+
# Upload the updated cache file for the next job by actions/cache

pom.xml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -557,22 +557,6 @@
557557
<version>1.20.1</version>
558558
<scope>test</scope>
559559
</dependency>
560-
561-
<!-- JMH -->
562-
563-
<dependency>
564-
<groupId>org.openjdk.jmh</groupId>
565-
<artifactId>jmh-core</artifactId>
566-
<version>1.37</version>
567-
<scope>test</scope>
568-
</dependency>
569-
<dependency>
570-
<groupId>org.openjdk.jmh</groupId>
571-
<artifactId>jmh-generator-annprocess</artifactId>
572-
<version>1.37</version>
573-
<scope>test</scope>
574-
</dependency>
575-
576560
</dependencies>
577561

578562
<build>
@@ -1165,7 +1149,7 @@
11651149

11661150
<profile>
11671151

1168-
<id>jmh</id>
1152+
<id>jmh</id> <!-- mvn -Pjmh clean test -->
11691153

11701154
<dependencies>
11711155
<dependency>
@@ -1177,13 +1161,29 @@
11771161
<dependency>
11781162
<groupId>org.openjdk.jmh</groupId>
11791163
<artifactId>jmh-generator-annprocess</artifactId>
1180-
<version>1.37</version>
1164+
<version>1.21</version>
11811165
<scope>test</scope>
11821166
</dependency>
11831167
</dependencies>
11841168

11851169
<build>
11861170
<plugins>
1171+
<plugin>
1172+
<groupId>org.apache.maven.plugins</groupId>
1173+
<artifactId>maven-compiler-plugin</artifactId>
1174+
<version>3.13.0</version>
1175+
<configuration>
1176+
<source>8</source>
1177+
<target>8 </target>
1178+
<annotationProcessorPaths>
1179+
<path>
1180+
<groupId>org.openjdk.jmh</groupId>
1181+
<artifactId>jmh-generator-annprocess</artifactId>
1182+
<version>1.21</version>
1183+
</path>
1184+
</annotationProcessorPaths>
1185+
</configuration>
1186+
</plugin>
11871187
<plugin>
11881188
<artifactId>maven-surefire-plugin</artifactId>
11891189
<configuration>

src/test/jmh/io/lettuce/core/JmhMain.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ private static void runRedisClientBenchmark() throws RunnerException {
3232

3333
private static ChainedOptionsBuilder prepareOptions() {
3434
return new OptionsBuilder().forks(1).warmupIterations(5).threads(1).measurementIterations(5)
35-
.timeout(TimeValue.seconds(2));
35+
.timeout(TimeValue.seconds(2)).output("benchmark.log");
3636
}
3737
}

0 commit comments

Comments
 (0)