Skip to content

Graceful shutdown of a stream for a single subscription #1523

Graceful shutdown of a stream for a single subscription

Graceful shutdown of a stream for a single subscription #1523

Workflow file for this run

# Copied from Flavio W. Brasil's work on Kyo: https://github.com/fwbrasil/kyo
name: profile
on:
push:
branches:
- main
pull_request:
types: [ opened, reopened, synchronize ]
permissions:
contents: write
deployments: write
jobs:
benchmark:
name: Profile benchmarks
runs-on: ubuntu-latest
if: ${{ !github.event.pull_request.head.repo.fork }} # comes from https://github.com/orgs/community/discussions/25217#discussioncomment-3246904
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0
- name: Setup Java
uses: actions/[email protected]
with:
distribution: temurin
java-version: 17
check-latest: true
- uses: coursier/[email protected]
- uses: VirtusLab/scala-cli-setup@main
- name: Use CI sbt jvmopts
shell: bash
run: |
mv .jvmopts .jvmopts_old
mv .jvmopts-ci .jvmopts
cat .jvmopts
- name: install async-profiler
run: |
ls -al
cd /home/runner
wget https://github.com/jvm-profiling-tools/async-profiler/releases/download/v2.9/async-profiler-2.9-linux-x64.tar.gz
tar -xvzf async-profiler-2.9-linux-x64.tar.gz
sudo mkdir -p /usr/java/packages/lib/
sudo cp async-profiler-2.9-linux-x64/build/libasyncProfiler.so /usr/java/packages/lib/
sudo sysctl kernel.perf_event_paranoid=1
sudo sysctl kernel.kptr_restrict=0
- name: run benchmarks
run: |
ls -al
cd /home/runner/work/zio-kafka/zio-kafka/
sbt "zioKafkaBench/Jmh/run -wi 10 -i 10 -r 1 -w 1 -t 1 -rf json -foe true -prof async:output=flamegraph"
- name: Rollback - Use CI sbt jvmopts
shell: bash
run: |
mv .jvmopts .jvmopts-ci
mv .jvmopts_old .jvmopts
cat .jvmopts
- name: Store flame graphs
run: |
echo "Store flame graphs"
echo "Collecting new flame graph"
git config pull.rebase true
read REV COMMIT_DATE COMMIT_TIME COMMIT_TZ COMMIT_MSG <<< \
$(git log --pretty=format:'%h %ad %s' --date=iso8601 -n 1 ${{ github.event.pull_request.head.sha }})
HTML_LINE=" <li>$COMMIT_DATE $COMMIT_TIME <a href=\"$REV\">Flame graphs for $REV</a> $COMMIT_MSG</li>"
echo "::group::Content of zio-kafka-bench directory"
ls -al zio-kafka-bench/
echo "::endgroup::"
mv zio-kafka-bench/zio.kafka.bench.* /tmp
echo "::group::Checkout gh-pages branch"
git clean -fdx
git checkout gh-pages
git pull
git config --global user.name "zio-kafka CI"
git config --global user.email "[email protected]"
echo "::endgroup::"
echo "Remove old flame graphs"
scala-cli scripts/prune-flame-graph.sc
echo "::group::Adding new flame graph"
mkdir -p dev/profile/$REV
mv /tmp/zio.kafka.bench.* dev/profile/$REV
cd dev/profile
find . -maxdepth 1 -type d \( ! -name . \) -exec bash -c "cd '{}' && tree -H . -o index.html" \;
sed -i'' -e '/NEW-FLAME-GRAPHS-GO-HERE/a\'$'\n'"$HTML_LINE"$'\n' index.html
cd ../../
git add .
git commit -m "Flame graphs for $REV"
git push
echo "::endgroup::"