Skip to content

Commit 6ff018b

Browse files
authored
Configure benchmark boxes to try and reduce noise (#6745)
This PR introduces a script to try and cleanup some noise from linux machines, disabling background services and trying to configuring memory behavior better. --------- Signed-off-by: Adam Gutglick <adam@spiraldb.com>
1 parent aff52ad commit 6ff018b

5 files changed

Lines changed: 43 additions & 0 deletions

File tree

.github/workflows/bench-pr.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ jobs:
5757
- uses: actions/checkout@v6
5858
with:
5959
ref: ${{ github.event.pull_request.head.sha }}
60+
- name: Setup benchmark environment
61+
run: sudo bash scripts/setup-benchmark.sh
6062
- uses: ./.github/actions/setup-rust
6163
with:
6264
repo-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/bench.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ jobs:
5454
with:
5555
sccache: s3
5656
- uses: actions/checkout@v6
57+
- name: Setup benchmark environment
58+
run: sudo bash scripts/setup-benchmark.sh
5759
- uses: ./.github/actions/setup-rust
5860
with:
5961
repo-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,8 @@ jobs:
726726
with:
727727
sccache: s3
728728
- uses: actions/checkout@v6
729+
- name: Setup benchmark environment
730+
run: sudo bash scripts/setup-benchmark.sh
729731
- uses: ./.github/actions/setup-rust
730732
with:
731733
repo-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/sql-benchmarks.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ jobs:
118118

119119
- uses: actions/checkout@v6
120120
if: inputs.mode != 'pr'
121+
- name: Setup benchmark environment
122+
run: sudo bash scripts/setup-benchmark.sh
121123
- uses: ./.github/actions/setup-rust
122124
with:
123125
repo-token: ${{ secrets.GITHUB_TOKEN }}

scripts/setup-benchmark.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env bash
2+
3+
# SPDX-License-Identifier: Apache-2.0
4+
# SPDX-FileCopyrightText: Copyright the Vortex contributors
5+
6+
set -Eeu -o pipefail -x
7+
8+
if [ "$EUID" -ne 0 ]; then
9+
echo "Environment setup script for benchmarks should run as root."
10+
exit 0
11+
fi
12+
13+
# Turn off frequency scaling
14+
for gov in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do
15+
echo performance > "$gov" 2>/dev/null || true
16+
done
17+
18+
# Really discourage swapping to disk
19+
sysctl vm.swappiness=0
20+
21+
# Disable ASLR - https://docs.kernel.org/admin-guide/sysctl/kernel.html#randomize-va-space
22+
sysctl kernel.randomize_va_space=0
23+
24+
# Reduce kernel logging to minimum
25+
dmesg -n 1
26+
27+
# Disable some unused services and features
28+
systemctl stop apparmor ModemManager
29+
systemctl disable apparmor ModemManager
30+
31+
# mask prevents them from being started by other services
32+
systemctl mask ModemManager
33+
34+
# For apparmor specifically, also teardown loaded profiles
35+
aa-teardown

0 commit comments

Comments
 (0)