Skip to content

Commit

Permalink
Merge pull request #7 from PhanLe1010/main
Browse files Browse the repository at this point in the history
Add more test modes and Implement a metric exporter
  • Loading branch information
PhanLe1010 authored Apr 27, 2024
2 parents 45a0d65 + 63924c9 commit 8fd580c
Show file tree
Hide file tree
Showing 34 changed files with 1,350 additions and 48 deletions.
21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Compiled Object files, Static and Dynamic libs (Shared Objects)
*.o
*.a
*.so

# Folders
_obj
_test

# Rancher
.dapper
trash.lock
.trash-conf
bin/

# patch tmp files
*.orig
*.rej

# editors
.idea
13 changes: 13 additions & 0 deletions Dockerfile.dapper
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM golang:1.17-alpine

RUN apk -U add bash git gcc musl-dev docker vim less file curl wget ca-certificates

ENV DAPPER_ENV REPO TAG
ENV DAPPER_SOURCE /go/src/github.com/yasker/kbench/
ENV DAPPER_OUTPUT ./bin
ENV DAPPER_DOCKER_SOCKET true
ENV HOME ${DAPPER_SOURCE}
WORKDIR ${DAPPER_SOURCE}

ENTRYPOINT ["./scripts/entry"]
CMD ["ci"]
25 changes: 22 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,23 @@
TARGETS := all
TARGETS := $(shell ls scripts)

.dapper:
@echo Downloading dapper
@curl -sL https://releases.rancher.com/dapper/latest/dapper-`uname -s`-`uname -m` > .dapper.tmp
@@chmod +x .dapper.tmp
@./.dapper.tmp -v
@mv .dapper.tmp .dapper

$(TARGETS): .dapper
./.dapper $@

deps: .dapper
./.dapper -m bind env GO111MODULE=on go mod vendor
./.dapper -m bind chown -R $$(id -u) vendor dist bin go.mod go.sum .cache

clean:
rm -rf bin dist

.DEFAULT_GOAL := ci

.PHONY: $(TARGETS)

$(TARGETS):
docker build -t yasker/kbench .
30 changes: 28 additions & 2 deletions deploy/fio-cmp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,34 @@ spec:
image: yasker/kbench:latest
imagePullPolicy: Always
env:
#- name: QUICK_MODE # for debugging
# value: "1"
# - name: MODE
# value: "quick" # for debugging
# - name: MODE
# value: "random-read-iops"
# - name: MODE
# value: "sequential-read-iops"
# - name: MODE
# value: "random-read-bandwidth"
# - name: MODE
# value: "sequential-read-bandwidth"
# - name: MODE
# value: "random-read-latency"
# - name: MODE
# value: "sequential-read-latency"
# - name: MODE
# value: "random-write-iops"
# - name: MODE
# value: "sequential-write-iops"
# - name: MODE
# value: "random-write-bandwidth"
# - name: MODE
# value: "sequential-write-bandwidth"
# - name: MODE
# value: "random-write-latency"
# - name: MODE
# value: "sequential-write-latency"
- name: MODE
value: "full" # run all tests
- name: FIRST_VOL_NAME
value: Local-Path
- name: FIRST_VOL_FILE
Expand Down
119 changes: 119 additions & 0 deletions deploy/fio-long-run.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
# Long-running test with prometheus metric exporter to monitor the data
apiVersion: v1
kind: Service
metadata:
name: test-sts
namespace: default
labels:
app: test-sts
spec:
selector:
app: test-sts
ports:
- name: http
port: 80
targetPort: metrics
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: test-sts
namespace: default
spec:
serviceName: test-sts
replicas: 1
selector:
matchLabels:
app: test-sts
podManagementPolicy: Parallel
template:
metadata:
labels:
app: test-sts
spec:
containers:
- name: kbench
image: phanle1010/kbench:dev
imagePullPolicy: Always
env:
- name: MODE
value: "random-read-iops"
- name: OUTPUT
value: /test-result/device
- name: FILE_NAME
value: "/volume/test"
- name: SIZE
value: "15G"
- name: CPU_IDLE_PROF
value: "disabled"
- name: SKIP_PARSE
value: "true"
- name: LONG_RUN
value: "true"
# - name: RATE_IOPS
# value: "617"
volumeMounts:
- name: vol
mountPath: /volume/
- name: shared-data
mountPath: /test-result
- name: metric-exporter
image: phanle1010/kbench:dev
imagePullPolicy: Always
readinessProbe:
exec:
command:
- sh
- -c
- '[ "$(ls -A /test-result)" ]'
initialDelaySeconds: 30
periodSeconds: 10
command:
- metric-exporter
- -d
- start
env:
- name: DATA_DIR
value: /test-result
- name: VOLUME_ACCESS_MODE
value: rwo
- name: TEST_MODE
value: read-only
- name: RATE_LIMIT_TYPE
value: no-rate-limit
ports:
- containerPort: 8080
name: metrics
volumeMounts:
- name: vol
mountPath: /volume/
- name: shared-data
mountPath: /test-result
volumes:
- name: shared-data
emptyDir: {}
volumeClaimTemplates:
- metadata:
name: vol
spec:
accessModes: ["ReadWriteOnce"]
storageClassName: "local-path"
resources:
requests:
storage: 20Gi
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: test-sts-servicemonitor
namespace: default
spec:
selector:
matchLabels:
app: test-sts
namespaceSelector:
matchNames:
- default
endpoints:
- port: http
interval: 30s
30 changes: 28 additions & 2 deletions deploy/fio.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,34 @@ spec:
image: yasker/kbench:latest
imagePullPolicy: Always
env:
#- name: QUICK_MODE # for debugging
# value: "1"
# - name: MODE
# value: "quick" # for debugging
# - name: MODE
# value: "random-read-iops"
# - name: MODE
# value: "sequential-read-iops"
# - name: MODE
# value: "random-read-bandwidth"
# - name: MODE
# value: "sequential-read-bandwidth"
# - name: MODE
# value: "random-read-latency"
# - name: MODE
# value: "sequential-read-latency"
# - name: MODE
# value: "random-write-iops"
# - name: MODE
# value: "sequential-write-iops"
# - name: MODE
# value: "random-write-bandwidth"
# - name: MODE
# value: "sequential-write-bandwidth"
# - name: MODE
# value: "random-write-latency"
# - name: MODE
# value: "sequential-write-latency"
- name: MODE
value: "full" # run all tests
- name: FILE_NAME
value: "/volume/test"
- name: SIZE
Expand Down
4 changes: 4 additions & 0 deletions fio/bandwidth-random-read.fio
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[rand-read-bw]
readwrite=randread
include bw-include.fio
include common-include.fio
4 changes: 4 additions & 0 deletions fio/bandwidth-random-write.fio
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[rand-write-bw]
readwrite=randwrite
include bw-include.fio
include common-include.fio
4 changes: 4 additions & 0 deletions fio/bandwidth-sequential-read.fio
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[seq-read-bw]
readwrite=read
include bw-include.fio
include common-include.fio
4 changes: 4 additions & 0 deletions fio/bandwidth-sequential-write.fio
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[seq-write-bw]
readwrite=write
include bw-include.fio
include common-include.fio
4 changes: 4 additions & 0 deletions fio/iops-random-read.fio
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[rand-read-iops]
readwrite=randread
include iops-include.fio
include common-include.fio
4 changes: 4 additions & 0 deletions fio/iops-random-write.fio
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[rand-write-iops]
readwrite=randwrite
include iops-include.fio
include common-include.fio
4 changes: 4 additions & 0 deletions fio/iops-sequential-read.fio
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[seq-read-iops]
readwrite=read
include iops-include.fio
include common-include.fio
4 changes: 4 additions & 0 deletions fio/iops-sequential-write.fio
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[seq-write-iops]
readwrite=write
include iops-include.fio
include common-include.fio
4 changes: 4 additions & 0 deletions fio/latency-random-read.fio
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[rand-read-lat]
readwrite=randread
include lat-include.fio
include common-include.fio
4 changes: 4 additions & 0 deletions fio/latency-random-write.fio
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[rand-write-lat]
readwrite=randwrite
include lat-include.fio
include common-include.fio
4 changes: 4 additions & 0 deletions fio/latency-sequential-read.fio
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[seq-read-lat]
readwrite=read
include lat-include.fio
include common-include.fio
4 changes: 4 additions & 0 deletions fio/latency-sequential-write.fio
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[seq-write-lat]
readwrite=write
include lat-include.fio
include common-include.fio
21 changes: 9 additions & 12 deletions fio/parse.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,27 @@ OUTPUT_IOPS=${PREFIX}-iops.json
OUTPUT_BW=${PREFIX}-bandwidth.json
OUTPUT_LAT=${PREFIX}-latency.json

if [ ! -f "$OUTPUT_IOPS" ]; then
echo "$OUTPUT_IOPS doesn't exist"
else
if [ -f "$OUTPUT_IOPS" ]; then
parse_iops $OUTPUT_IOPS
fi

if [ ! -f "$OUTPUT_BW" ]; then
echo "$OUTPUT_BW doesn't exist"
else
if [ -f "$OUTPUT_BW" ]; then
parse_bw $OUTPUT_BW
fi

if [ ! -f "$OUTPUT_LAT" ]; then
echo "$OUTPUT_LAT doesn't exist"
else
if [ -f "$OUTPUT_LAT" ]; then
parse_lat $OUTPUT_LAT
fi

RESULT=${1}.summary

QUICK_MODE_TEXT="Quick Mode: disabled"
if [ -n "$QUICK_MODE" ]; then
QUICK_MODE_TEXT="Quick Mode: enabled"
MODE="quick"
fi
if [ -z "$MODE" ]; then
MODE="full"
fi
MODE_TEXT="Mode: $MODE"

SIZE_TEXT="Size: 10g"
if [ -n "$SIZE" ]; then
Expand All @@ -52,7 +49,7 @@ FIO Benchmark Summary
For: $PREFIX
CPU Idleness Profiling: $CPU_IDLE_PROF
$SIZE_TEXT
$QUICK_MODE_TEXT
$MODE_TEXT
=========================
"

Expand Down
Loading

0 comments on commit 8fd580c

Please sign in to comment.