Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change some code and automation #8

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 27 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,31 @@
FROM dmonakhov/alpine-fio
FROM alpine

MAINTAINER Lee Liu <[email protected]>
MAINTAINER Dmitry Monakhov [email protected]

# Install build deps + permanent dep: libaio
RUN apk --no-cache add \
make \
alpine-sdk \
zlib-dev \
libaio-dev \
linux-headers \
coreutils \
grep \
libaio && \
git clone https://github.com/axboe/fio && \
cd fio && \
./configure && \
make -j`nproc` && \
make install && \
cd .. && \
rm -rf fio && \
apk --no-cache del \
make \
alpine-sdk \
zlib-dev \
libaio-dev \
linux-headers \
coreutils

VOLUME /tmp
WORKDIR /tmp
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ Mixed Random Read/Write IOPS: 43.1k/14.4k
* It's useful to test multiple disk sizes as most cloud providers price IOPS per GB provisioned. So a `4000Gi` volume will perform better than a `1000Gi` volume. Just edit the yaml, `kubectl delete -f dbench.yaml` and run `kubectl apply -f dbench.yaml` again after deprovision/delete completes.
* A list of all `fio` tests are in [docker-entrypoint.sh](https://github.com/logdna/dbench/blob/master/docker-entrypoint.sh).


## Fixed history (Mar 28 2022)
Dbench Summary could not show up properly when parameter have blank(s) - add to \b on docker-entrypoint


## Contributors

* Lee Liu (LogDNA)
Expand Down
45 changes: 26 additions & 19 deletions dbench.yaml
Original file line number Diff line number Diff line change
@@ -1,48 +1,55 @@
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: dbench-pv-claim
name: kdbench-pv-claim
labels:
fio: kdbench
spec:
storageClassName: ssd
# storageClassName: gp2
# storageClassName: local-storage
# storageClassName: ibmc-block-bronze
# storageClassName: ibmc-block-silver
# storageClassName: ibmc-block-gold
storageClassName: your-storageclass
# storageClassName: managed-nfs-storage
# storageClassName: gp2
# storageClassName: default
# storageClassName: standard
# storageClassName: nks-block-storage
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1000Gi
storage: 100Gi
---
apiVersion: batch/v1
kind: Job
metadata:
name: dbench
name: kdbench
labels:
fio: kdbench
spec:
ttlSecondsAfterFinished: 0
template:
spec:
containers:
- name: dbench
image: logdna/dbench:latest
- name: kdbench
image: sysnet4admin/kdbench:latest
imagePullPolicy: Always
env:
- name: DBENCH_MOUNTPOINT
value: /data
# - name: DBENCH_QUICK
- name: KDBENCH_MOUNTPOINT
value: /ON-your-storageclass
- name: STORAGECLASS
value: your-storageclass
# - name: KDBENCH_QUICK
# value: "yes"
# - name: FIO_SIZE
# value: 1G
# - name: FIO_OFFSET_INCREMENT
# value: 256M
# - name: FIO_DIRECT
# value: "0"
# value: "1"
volumeMounts:
- name: dbench-pv
mountPath: /data
- name: kdbench-pv
mountPath: /ON-your-storageclass
restartPolicy: Never
volumes:
- name: dbench-pv
- name: kdbench-pv
persistentVolumeClaim:
claimName: dbench-pv-claim
claimName: kdbench-pv-claim
backoffLimit: 4
23 changes: 14 additions & 9 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,16 @@ if [ "$1" = 'fio' ]; then
echo Testing Read Latency...
READ_LATENCY=$(fio --randrepeat=0 --verify=0 --ioengine=libaio --direct=$FIO_DIRECT --name=read_latency --filename=$DBENCH_MOUNTPOINT/fiotest --bs=4K --iodepth=4 --size=$FIO_SIZE --readwrite=randread --time_based --ramp_time=2s --runtime=15s)
echo "$READ_LATENCY"
READ_LATENCY_VAL=$(echo "$READ_LATENCY"|grep ' lat.*avg'|grep -Eoi 'avg=[0-9.]+'|cut -d'=' -f2)
READ_LATENCY_VAL=$(echo "$READ_LATENCY"|grep ' lat.*avg'|grep -Eoi 'avg=[\b 0-9.]+'|cut -d'=' -f2)
READ_LATENCY_UNIT=$(echo "$READ_LATENCY"|grep ' lat.*avg'|grep -oP '(?<=lat )[^ ]*'|grep -Eoi '[a-z]+')
echo
echo

echo Testing Write Latency...
WRITE_LATENCY=$(fio --randrepeat=0 --verify=0 --ioengine=libaio --direct=$FIO_DIRECT --name=write_latency --filename=$DBENCH_MOUNTPOINT/fiotest --bs=4K --iodepth=4 --size=$FIO_SIZE --readwrite=randwrite --time_based --ramp_time=2s --runtime=15s)
echo "$WRITE_LATENCY"
WRITE_LATENCY_VAL=$(echo "$WRITE_LATENCY"|grep ' lat.*avg'|grep -Eoi 'avg=[0-9.]+'|cut -d'=' -f2)
WRITE_LATENCY_VAL=$(echo "$WRITE_LATENCY"|grep ' lat.*avg'|grep -Eoi 'avg=[\b 0-9.]+'|cut -d'=' -f2)
WRITE_LATENCY_UNIT=$(echo "$WRITE_LATENCY"|grep ' lat.*avg'|grep -oP '(?<=lat )[^ ]*'|grep -Eoi '[a-z]+')
echo
echo

Expand Down Expand Up @@ -90,14 +92,17 @@ if [ "$1" = 'fio' ]; then

echo All tests complete.
echo
echo ==================
echo = Dbench Summary =
echo ==================
echo "Random Read/Write IOPS: $READ_IOPS_VAL/$WRITE_IOPS_VAL. BW: $READ_BW_VAL / $WRITE_BW_VAL"
echo =============================
echo = Kubernetes Dbench Summary =
echo =============================
echo -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
echo -e "|| Random Read/Write IOPS\t | $READ_IOPS_VAL / $WRITE_IOPS_VAL\t ||"
echo -e "|| Bandwidth Read/Write\t | $READ_BW_VAL / $WRITE_BW_VAL\t ||"
if [ -z $DBENCH_QUICK ] || [ "$DBENCH_QUICK" == "no" ]; then
echo "Average Latency (usec) Read/Write: $READ_LATENCY_VAL/$WRITE_LATENCY_VAL"
echo "Sequential Read/Write: $READ_SEQ_VAL / $WRITE_SEQ_VAL"
echo "Mixed Random Read/Write IOPS: $RW_MIX_R_IOPS/$RW_MIX_W_IOPS"
echo -e "|| Average Latency Read/Write\t | $READ_LATENCY_VAL($READ_LATENCY_UNIT) / $WRITE_LATENCY_VAL($WRITE_LATENCY_UNIT)\t ||"
echo -e "|| Sequential Read/Write\t | $READ_SEQ_VAL / $WRITE_SEQ_VAL\t ||"
echo -e "|| Mixed Random Read/Write IOPS\t | $RW_MIX_R_IOPS / $RW_MIX_W_IOPS\t ||"
echo -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
fi

rm $DBENCH_MOUNTPOINT/fiotest
Expand Down