-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Fatih Acar <[email protected]>
- Loading branch information
1 parent
23198a1
commit 6baa276
Showing
3 changed files
with
117 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
--- | ||
# yamllint disable rule:truthy | ||
name: Build And Push Bench image | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- fac-bench-tool | ||
|
||
env: | ||
DOCKERFILE: "utilities/benchmark/Dockerfile" | ||
|
||
jobs: | ||
build: | ||
runs-on: | ||
group: huge-runners | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
id: login | ||
with: | ||
registry: ${{ vars.HARBOR_HOST }} | ||
username: ${{ secrets.HARBOR_USERNAME }} | ||
password: ${{ secrets.HARBOR_PASSWORD }} | ||
|
||
- name: Set docker image meta data | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: | | ||
${{ vars.HARBOR_HOST }}/opsmill/bench | ||
tags: | | ||
type=raw,value=latest | ||
labels: | | ||
org.opencontainers.image.source=opsmill/bench | ||
flavor: | | ||
latest=true | ||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
id: push | ||
with: | ||
context: utilities/benchmark | ||
file: ${{ env.DOCKERFILE }} | ||
provenance: false # To avoid cross platform "unknown" | ||
push: true | ||
platforms: linux/amd64,linux/arm64 | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
ARG TARGETPLATFORM | ||
FROM debian:bookworm-slim | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y curl libncurses5 unzip yq jq fio | ||
|
||
COPY entrypoint.sh /entrypoint.sh | ||
|
||
RUN bash -c 'curl -o pt_linux.zip https://www.passmark.com/downloads/pt_linux_$([ "$TARGETPLATFORM" == "linux/amd64" ] && echo "x64" || echo "arm64").zip' && \ | ||
unzip pt_linux.zip && \ | ||
mv PerformanceTest/pt_linux_* /usr/local/bin/pt_linux && \ | ||
rm -rf PerformanceTest pt_linux.zip && \ | ||
chmod +x /entrypoint.sh && \ | ||
apt-get autoremove -y && \ | ||
apt-get clean all && \ | ||
rm -rf /var/lib/apt/lists/* && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
CMD /entrypoint.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/sh | ||
|
||
READ_IOPS_LIMIT=5000 | ||
WRITE_IOPS_LIMIT=5000 | ||
RAM_LIMIT=8000 | ||
SINGLETHREAD_PERF_LIMIT=1500 | ||
|
||
fio --randrepeat=1 --ioengine=libaio --direct=1 --gtod_reduce=1 --name=test --filename=randomrw.fio --bs=4k --iodepth=64 --size=128M --readwrite=randrw --rwmixread=75 --output=fio_results.json --output-format=json | ||
|
||
READ_IOPS=$(printf "%.0f" $(jq '.jobs[0].read.iops' fio_results.json)) | ||
WRITE_IOPS=$(printf "%.0f" $(jq '.jobs[0].write.iops' fio_results.json)) | ||
|
||
TERM=xterm pt_linux -d 1 -r 1 -i 1 | ||
|
||
TOTAL_RAM=$(yq .SystemInformation.Memory results_cpu.yml) | ||
SINGLETHREAD_PERF=$(printf "%.0f" $(yq .Results.CPU_SINGLETHREAD results_cpu.yml)) | ||
|
||
NC='\033[0m' | ||
RED='\033[0;31m' | ||
GREEN='\033[0;32m' | ||
|
||
[ $TOTAL_RAM -lt $RAM_LIMIT ] && echo -n $RED || echo -n $GREEN | ||
echo -n "Memory: ${TOTAL_RAM} MB - Required: ${RAM_LIMIT} MB " | ||
[ $TOTAL_RAM -lt $RAM_LIMIT ] && echo ": KO" || echo ": OK" | ||
|
||
[ $SINGLETHREAD_PERF -lt $SINGLETHREAD_PERF_LIMIT ] && echo -n $RED || echo -n $GREEN | ||
echo -n "CPU Perf: ${SINGLETHREAD_PERF} - Required: ${SINGLETHREAD_PERF_LIMIT} " | ||
[ $SINGLETHREAD_PERF -lt $SINGLETHREAD_PERF_LIMIT ] && echo ": KO" || echo ": OK" | ||
|
||
[ $READ_IOPS -lt $READ_IOPS_LIMIT ] && echo -n $RED || echo -n $GREEN | ||
echo -n "Read IOPS: ${READ_IOPS} - Required: ${READ_IOPS_LIMIT} " | ||
[ $READ_IOPS -lt $READ_IOPS_LIMIT ] && echo ": KO" || echo ": OK" | ||
|
||
[ $WRITE_IOPS -lt $WRITE_IOPS_LIMIT ] && echo -n $RED || echo -n $GREEN | ||
echo -n "Write IOPS: ${WRITE_IOPS} - Required: ${WRITE_IOPS_LIMIT} " | ||
[ $WRITE_IOPS -lt $WRITE_IOPS_LIMIT ] && echo ": KO" || echo ": OK" | ||
|