diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index 66284e7e3..a560acf52 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -1,13 +1,29 @@ name: Benchmarks on: +# push: +# paths-ignore: +# - 'docs/**' +# - '**/*.md' +# - '**/*.rst' +# branches: +# - main +# - '[0-9].*' +# pull_request: +# branches: +# - main +# - '[0-9].*' schedule: - cron: '0 1 * * *' # nightly build workflow_dispatch: +#permissions: + # For commenting alerts on commits + # contents: write + jobs: benchmark: - name: Build and Test + name: Execute benchmarks runs-on: ubuntu-latest steps: - name: Checkout project @@ -54,12 +70,14 @@ jobs: - name: Store benchmark result uses: benchmark-action/github-action-benchmark@v1 with: - # What benchmark tool the output.txt came from + github-token: ${{ secrets.GITHUB_TOKEN }} tool: 'jmh' - # Where the output from the benchmark tool is stored + auto-push: true + gh-repository: 'github.com/redis/lettuce' + gh-pages-branch: 'benchmarks' + benchmark-data-dir-path: './' output-file-path: benchmark.log - # Where the previous data file is stored - external-data-json-path: ./cache/benchmark.log - # Workflow will fail when an alert happens - fail-on-alert: true - # Upload the updated cache file for the next job by actions/cache + fail-on-alert: false + alert-threshold: '200%' + alert-comment-cc-users: '@tishun' + # comment-on-alert: true diff --git a/pom.xml b/pom.xml index 710d1f359..2838145a7 100644 --- a/pom.xml +++ b/pom.xml @@ -557,6 +557,22 @@ <version>1.20.1</version> <scope>test</scope> </dependency> + + <!-- JMH --> + + <dependency> + <groupId>org.openjdk.jmh</groupId> + <artifactId>jmh-core</artifactId> + <version>1.21</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.openjdk.jmh</groupId> + <artifactId>jmh-generator-annprocess</artifactId> + <version>1.21</version> + <scope>test</scope> + </dependency> + </dependencies> <build> @@ -1234,19 +1250,66 @@ <argument>org.openjdk.jmh.Main</argument> <argument>.*</argument> <argument>-tu</argument> + <!-- + Override time unit in benchmark results. Available + time units are: [m, s, ms, us, ns]. + --> <argument>ns</argument> <argument>-f</argument> + <!-- + How many times to fork a single benchmark. Use 0 to + disable forking altogether. Warning: disabling + forking may have detrimental impact on benchmark + and infrastructure reliability, you might want + to use different warmup mode instead. + --> <argument>1</argument> <argument>-wi</argument> + <!-- + Number of warmup iterations to do. Warmup iterations + are not counted towards the benchmark score. + --> <argument>10</argument> <argument>-w</argument> + <!-- + Minimum time to spend at each warmup iteration. Benchmarks + may generally run longer than iteration duration. + --> <argument>1</argument> <argument>-r</argument> + <!-- + Minimum time to spend at each measurement iteration. + Benchmarks may generally run longer than iteration + duration. + --> <argument>1</argument> <argument>-i</argument> + <!-- + Number of measurement iterations to do. Measurement + iterations are counted towards the benchmark score. + --> <argument>10</argument> <argument>-bm</argument> + <!-- + Benchmark mode. Available modes are: [Throughput/thrpt, + AverageTime/avgt, SampleTime/sample, SingleShotTime/ss, + All/all] + --> <argument>avgt</argument> + <argument>-rf</argument> + <!-- + Format type for machine-readable results. These + results are written to a separate file (see -rff). + See the list of available result formats with -lrf. + --> + <argument>json</argument> + <argument>-rff</argument> + <!-- + Write machine-readable results to a given file. + The file format is controlled by -rf option. Please + see the list of result formats for available formats. + --> + <argument>benchmarks.json</argument> </arguments> </configuration> </execution>