Skip to content

Commit 434c4a4

Browse files
author
Pat
authored
workflows: add PR performance test (fluent#5620)
* workflows: add PR performance test Signed-off-by: Patrick Stephens <[email protected]> * workflows: fix linting Signed-off-by: Patrick Stephens <[email protected]> * workflows: disable unit tests firing for examples [skip-ci] Signed-off-by: Patrick Stephens <[email protected]>
1 parent 7c3910c commit 434c4a4

File tree

9 files changed

+184
-0
lines changed

9 files changed

+184
-0
lines changed

.github/workflows/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
| [pr-closed-docker](./pr-closed-docker.yaml) | Removes docker images for PR on hub.docker.io/fluentbitdev/| on pr closed|
1212
| [pr-compile-check](./pr-compile-check.yaml) | Runs some compilation sanity checks on a PR |
1313
| [pr-integration-test](./pr-integration-test.yaml) | Runs the integration testing suite on a PR branch | pr opened / label created 'ok-to-test' / on new commit/push on PR(s) |
14+
| [pr-perf-test](./pr-integration-test.yaml) | Runs the performance testing suite on a PR branch | pr opened / label created 'ok-to-performance-test' / on new commit/push on PR(s) |
1415
| [pr-stale](./pr-stale.yaml) | Closes stale PR(s) with no activity in 30 days | scheduled daily 01:30 AM UTC|
1516
| [unit-tests](./unit-tests.yaml) | Runs the unit tests suite on master push or new PR | PR opened, merge in master branch |
1617

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Build and run performance tests for PR
2+
on:
3+
pull_request:
4+
branches:
5+
- master
6+
types:
7+
- labeled
8+
9+
jobs:
10+
11+
# TODO: switch to dedicated runner workflow
12+
pr-perf-test-run:
13+
# We only need to test this once as the rest are chained from it.
14+
if: contains(github.event.pull_request.labels.*.name, 'ok-to-performance-test')
15+
name: Run performance tests for PR
16+
runs-on: ubuntu-20.04
17+
steps:
18+
- uses: actions/checkout@v3
19+
20+
- name: Install dependencies
21+
run: |
22+
sudo apt update
23+
sudo apt-get install -y jq
24+
25+
# Install docker-compose
26+
# Later versions have an SSL issue on this OS for remote repository builds
27+
sudo curl --fail --silent -L "https://github.com/docker/compose/releases/download/1.25.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
28+
sudo chmod a+x /usr/local/bin/docker-compose
29+
30+
# Add promplot
31+
curl --fail --silent -L https://github.com/qvl/promplot/releases/download/v0.17.0/promplot_0.17.0_linux_64bit.tar.gz| tar -xz
32+
chmod a+x ./promplot
33+
sudo mv -vf ./promplot /usr/local/bin/promplot
34+
shell: bash
35+
36+
- name: Run the tests on this runner
37+
timeout-minutes: 45
38+
run: |
39+
curl -L https://raw.githubusercontent.com/fluent/fluent-bit-ci/master/scripts/docker-compose-monitor.sh | bash
40+
shell: bash
41+
env:
42+
TEST_DIRECTORY: ./examples/perf-test
43+
SERVICE_TO_MONITOR: fb-delta
44+
RUN_TIMEOUT_MINUTES: 30
45+
46+
- name: Upload any results
47+
if: always()
48+
uses: actions/upload-artifact@v3
49+
with:
50+
name: output
51+
path: output/
52+
53+
pr-perf-test-complete:
54+
name: PR - performance test complete
55+
runs-on: ubuntu-latest
56+
needs:
57+
- pr-perf-test-run
58+
steps:
59+
# TODO: post results as well
60+
- uses: actions-ecosystem/action-add-labels@v1
61+
name: Label the PR
62+
with:
63+
labels: ci/performance-test-ok
64+
github_token: ${{ secrets.GITHUB_TOKEN }}
65+
number: ${{ github.event.pull_request.number }}

.github/workflows/skipped-unit-tests.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ on:
1111
- '.gitignore'
1212
- 'appveyor.yml'
1313
- '**.sh'
14+
- 'examples/**'
1415

1516
jobs:
1617
run-all-unit-tests:

.github/workflows/unit-tests.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ on:
1414
- '.gitignore'
1515
- 'appveyor.yml'
1616
- '**.sh'
17+
- 'examples/**'
1718
branches:
1819
- master
1920
- 1.9

examples/perf_test/.env

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FB_BASELINE_IMAGE=fluent/fluent-bit:latest
2+
LOG_PREFIX=test
3+
LOG_COUNT=100
4+
LOG_RATE=2000
5+
LOG_SIZE=1000
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
version: "3"
2+
3+
services:
4+
5+
fb-baseline:
6+
image: ${FB_BASELINE_IMAGE}
7+
volumes:
8+
- log-volume:/logs:ro
9+
- ./fluent-bit.conf:/fluent-bit/etc/fluent-bit.conf:ro
10+
11+
fb-delta:
12+
build:
13+
context: ../..
14+
dockerfile: dockerfiles/Dockerfile
15+
volumes:
16+
- log-volume:/logs:ro
17+
- ./fluent-bit.conf:/fluent-bit/etc/fluent-bit.conf:ro
18+
ports:
19+
- "2020:2020"
20+
21+
data-generator:
22+
image: fluentbitdev/fluent-bit-ci:benchmark
23+
command: bash /scripts/entrypoint.sh
24+
volumes:
25+
- log-volume:/logs:rw
26+
- ./scripts:/scripts:ro
27+
environment:
28+
LOG_PREFIX: ${LOG_PREFIX}
29+
LOG_COUNT: ${LOG_COUNT}
30+
LOG_SIZE: ${LOG_SIZE}
31+
# For multiline set this to >0
32+
LINE_COUNT: ${LINE_COUNT}
33+
# For multiline set this to the sleep period between log entries rather than the rate
34+
LOG_RATE: ${LOG_RATE}
35+
36+
volumes:
37+
log-volume:

examples/perf_test/fluent-bit.conf

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
[SERVICE]
2+
Daemon Off
3+
# Log_Level debug
4+
HTTP_Server On
5+
# HTTP_Listen 0.0.0.0
6+
HTTP_Port 2020
7+
flush 1
8+
storage.metrics on
9+
storage.path /data/
10+
storage.sync normal
11+
storage.checksum off
12+
storage.backlog.mem_limit 1G
13+
storage.max_chunks_up 128
14+
15+
[INPUT]
16+
Name dummy
17+
fixed_timestamp on
18+
19+
[INPUT]
20+
Name tail
21+
Path /logs/*
22+
# Intended for use with multiline data generator
23+
multiline.parser java
24+
25+
[OUTPUT]
26+
Name null
27+
Match *
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
set -eu
3+
4+
LOG_DIR=${LOG_DIR:-/logs}
5+
LOG_PREFIX=${LOG_PREFIX:-multi}
6+
LOG_COUNT=${LOG_COUNT:-100}
7+
LOG_RATE=${LOG_RATE:-20}
8+
LOG_SIZE=${LOG_SIZE:-1000}
9+
LINE_COUNT=${LINE_COUNT:-0}
10+
11+
rm -vfr "${LOG_DIR:?}/$LOG_PREFIX*"
12+
13+
for i in $(seq "$LOG_COUNT")
14+
do
15+
export OUTPUT_LOGFILE="$LOG_DIR/$LOG_PREFIX-$i.log"
16+
if [[ "$LINE_COUNT" -gt 0 ]]; then
17+
/scripts/multi-line-log-generator.sh &
18+
else
19+
echo "Creating $OUTPUT_LOGFILE"
20+
/run_log_generator.py --log-size-in-bytes "$LOG_SIZE" --log-rate "$LOG_RATE" --log-agent-input-type tail --tail-file-path "$OUTPUT_LOGFILE" &
21+
fi
22+
done
23+
24+
wait
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
set -eu
3+
4+
5+
OUTPUT_LOGFILE=${OUTPUT_LOGFILE:-/logs/test.log}
6+
rm -fv "$OUTPUT_LOGFILE"
7+
8+
LOG_RATE=${LOG_RATE:-0.2}
9+
LINE_COUNT=${LINE_COUNT:-100}
10+
11+
echo "Sleep for $LOG_RATE and create $OUTPUT_LOGFILE with $LINE_COUNT+1 lines per entry"
12+
13+
while true; do
14+
cat >> "$OUTPUT_LOGFILE" << EOF
15+
Exception in thread "main" java.lang.RuntimeException: A test exception
16+
EOF
17+
for _ in $(seq "$LINE_COUNT"); do
18+
cat >> "$OUTPUT_LOGFILE" << EOF
19+
at com.stackify.stacktrace.StackTraceExample.methodB(StackTraceExample.java:13)
20+
EOF
21+
done
22+
sleep "$LOG_RATE"
23+
done

0 commit comments

Comments
 (0)