Skip to content

Commit 4d59c03

Browse files
committed
ci: introduce the performance workflow
This patch adds the workflow to run benchmarks from various suites, aggregate their results, and send statistics to the InfluxDB to be processed later. The workflow contains a matrix to measure GC64 and non-GC64 modes with enabled/disabled JIT for x64 architecture.
1 parent 56ecc74 commit 4d59c03

File tree

3 files changed

+138
-0
lines changed

3 files changed

+138
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Setup performance
2+
3+
Action setups the performance on Linux runners.
4+
5+
## How to use Github Action from Github workflow
6+
7+
Add the following code to the running steps before LuaJIT configuration:
8+
```
9+
- uses: ./.github/actions/setup-performance
10+
```
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Setup performance
2+
description: The Linux machine setup for running LuaJIT benchmarks
3+
runs:
4+
using: composite
5+
steps:
6+
- name: Setup CI environment (Linux)
7+
uses: ./.github/actions/setup-linux
8+
- name: Install dependencies for the LuaJIT benchmarks
9+
run: |
10+
apt -y update
11+
apt install -y luarocks curl
12+
shell: bash
13+
- name: Install Lua modules
14+
run: luarocks install lua-cjson
15+
shell: bash
16+
- name: Run script to setup Linux environment
17+
run: sh ./perf/helpers/setup_env.sh
18+
shell: bash

.github/workflows/performance.yml

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
name: Performance
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- '**-noperf'
7+
- 'tarantool/release/**'
8+
- 'upstream-**'
9+
tags-ignore:
10+
- '**'
11+
schedule:
12+
# Once a day at 03:00 to avoid clashing with runs for the
13+
# Tarantool benchmarks at midnight.
14+
- cron: '0 3 * * *'
15+
16+
concurrency:
17+
# An update of a developer branch cancels the previously
18+
# scheduled workflow run for this branch. However, the default
19+
# branch, and long-term branch (tarantool/release/2.11,
20+
# tarantool/release/2.10, etc) workflow runs are never canceled.
21+
#
22+
# We use a trick here: define the concurrency group as 'workflow
23+
# run ID' + # 'workflow run attempt' because it is a unique
24+
# combination for any run. So it effectively discards grouping.
25+
#
26+
# XXX: we cannot use `github.sha` as a unique identifier because
27+
# pushing a tag may cancel a run that works on a branch push
28+
# event.
29+
group: ${{ startsWith(github.ref, 'refs/heads/tarantool/')
30+
&& format('{0}-{1}', github.run_id, github.run_attempt)
31+
|| format('{0}-{1}', github.workflow, github.ref) }}
32+
cancel-in-progress: true
33+
34+
jobs:
35+
performance-luajit:
36+
# The 'performance' label _must_ be set only for the single
37+
# runner to guarantee that results are not dependent on the
38+
# machine.
39+
runs-on:
40+
- self-hosted
41+
- Linux
42+
- x86_64
43+
- 'performance'
44+
45+
env:
46+
PERF_BRANCH: ${{ github.ref_name }}
47+
PERF_COMMIT: ${{ github.sha }}
48+
49+
strategy:
50+
fail-fast: false
51+
matrix:
52+
GC64: [ON, OFF]
53+
JOFF: [ON, OFF]
54+
# Run each job sequentially.
55+
max-parallel: 1
56+
name: >
57+
LuaJIT
58+
GC64:${{ matrix.GC64 }}
59+
JOFF:${{ matrix.JOFF }}
60+
steps:
61+
- uses: actions/checkout@v4
62+
with:
63+
fetch-depth: 0
64+
submodules: recursive
65+
- name: setup performance environment
66+
uses: ./.github/actions/setup-performance
67+
- name: configure
68+
# The taskset alone will pin all the process threads
69+
# into a single (random) isolated CPU, see
70+
# https://bugzilla.kernel.org/show_bug.cgi?id=116701.
71+
# The workaround is using realtime scheduler for the
72+
# isolated task using chrt, e. g.:
73+
# sudo taskset 0xef chrt 50.
74+
# But this makes the process use non-standard, real-time
75+
# round-robin scheduling mechanism.
76+
run: >
77+
cmake -S . -B ${{ env.BUILDDIR }}
78+
-DCMAKE_BUILD_TYPE=RelWithDebInfo
79+
-DLUAJIT_ENABLE_PERF=ON
80+
-DLUAJIT_BENCH_INIT="taskset 0xfe chrt 50"
81+
-DLUAJIT_DISABLE_JIT=${{ matrix.JOFF }}
82+
-DLUAJIT_ENABLE_GC64=${{ matrix.GC64 }}
83+
- name: build
84+
run: cmake --build . --parallel
85+
working-directory: ${{ env.BUILDDIR }}
86+
- name: perf
87+
run: make LuaJIT-perf
88+
working-directory: ${{ env.BUILDDIR }}
89+
- name: aggregate benchmark results
90+
run: make LuaJIT-perf-aggregate
91+
working-directory: ${{ env.BUILDDIR }}
92+
- name: send statistics to InfluxDB
93+
# --silent -o /dev/null: Prevent dumping any reply part
94+
# in the output in case of an error.
95+
# --fail: Exit with the 22 error code is status >= 400.
96+
# --write-out: See the reason for the failure, if any.
97+
# --retry, --retry-delay: To avoid losing the results of
98+
# running after such a long job, try to retry sending the
99+
# results.
100+
run: >
101+
curl --request POST
102+
"${{ secrets.INFLUXDB_URL }}/api/v2/write?org=tarantool&bucket=luajit-performance&precision=s"
103+
--write-out "%{http_code}"
104+
--retry 5
105+
--retry-delay 5
106+
--connect-timeout 120
107+
--fail --silent -o /dev/null
108+
--header "Authorization: Token ${{ secrets.INFLUXDB_TOKEN }}"
109+
--data-binary @./perf/output/summary.txt
110+
working-directory: ${{ env.BUILDDIR }}

0 commit comments

Comments
 (0)