Initial commit

This commit is contained in:
Scooby Husky
2026-03-09 20:21:35 -05:00
commit aacb8eebbe
314 changed files with 21766 additions and 0 deletions
+233
View File
@@ -0,0 +1,233 @@
---
# V1 PVC (traditional iSCSI engine)
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: benchmark-v1-pvc
namespace: default
spec:
accessModes:
- ReadWriteOnce
storageClassName: longhorn # V1 engine (default)
resources:
requests:
storage: 50Gi
---
# V2 PVC (SPDK engine)
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: benchmark-v2-pvc
namespace: default
spec:
accessModes:
- ReadWriteOnce
storageClassName: longhorn-v2 # V2 SPDK engine
resources:
requests:
storage: 50Gi
---
# Benchmark scripts ConfigMap
apiVersion: v1
kind: ConfigMap
metadata:
name: v1-v2-benchmark-scripts
namespace: default
data:
run-benchmarks.sh: |
#!/bin/sh
set -e
ENGINE=$1
DATA_DIR=$2
echo "=========================================="
echo "Longhorn $ENGINE Data Engine Benchmark"
echo "=========================================="
echo "Test file: $DATA_DIR/testfile (10GB)"
echo ""
# Sequential Write
echo "1. Sequential Write Test..."
fio --name=seq-write \
--filename=$DATA_DIR/testfile \
--size=10G \
--rw=write \
--bs=1M \
--direct=1 \
--numjobs=1 \
--time_based \
--runtime=60 \
--group_reporting \
--output-format=normal | tee /tmp/seq-write.log
SEQ_WRITE_BW=$(grep "WRITE:" /tmp/seq-write.log | awk '{print $2}' | sed 's/bw=//;s/,//')
SEQ_WRITE_IOPS=$(grep "WRITE:" /tmp/seq-write.log | awk '{print $4}' | sed 's/IOPS=//;s/,//')
echo ""
echo "=========================================="
echo ""
# Sequential Read
echo "2. Sequential Read Test..."
fio --name=seq-read \
--filename=$DATA_DIR/testfile \
--rw=read \
--bs=1M \
--direct=1 \
--numjobs=1 \
--time_based \
--runtime=60 \
--group_reporting \
--output-format=normal | tee /tmp/seq-read.log
SEQ_READ_BW=$(grep "READ:" /tmp/seq-read.log | awk '{print $2}' | sed 's/bw=//;s/,//')
SEQ_READ_IOPS=$(grep "READ:" /tmp/seq-read.log | awk '{print $4}' | sed 's/IOPS=//;s/,//')
echo ""
echo "=========================================="
echo ""
# Random Write
echo "3. Random Write Test (4K blocks)..."
fio --name=rand-write \
--filename=$DATA_DIR/testfile \
--rw=randwrite \
--bs=4k \
--direct=1 \
--numjobs=4 \
--time_based \
--runtime=60 \
--group_reporting \
--output-format=normal | tee /tmp/rand-write.log
RAND_WRITE_IOPS=$(grep "WRITE:" /tmp/rand-write.log | awk '{print $4}' | sed 's/IOPS=//;s/,//')
RAND_WRITE_BW=$(grep "WRITE:" /tmp/rand-write.log | awk '{print $2}' | sed 's/bw=//;s/,//')
echo ""
echo "=========================================="
echo ""
# Random Read
echo "4. Random Read Test (4K blocks)..."
fio --name=rand-read \
--filename=$DATA_DIR/testfile \
--rw=randread \
--bs=4k \
--direct=1 \
--numjobs=4 \
--time_based \
--runtime=60 \
--group_reporting \
--output-format=normal | tee /tmp/rand-read.log
RAND_READ_IOPS=$(grep "READ:" /tmp/rand-read.log | awk '{print $4}' | sed 's/IOPS=//;s/,//')
RAND_READ_BW=$(grep "READ:" /tmp/rand-read.log | awk '{print $2}' | sed 's/bw=//;s/,//')
echo ""
echo "=========================================="
echo "$ENGINE Engine Results Summary"
echo "=========================================="
echo "Sequential Write: $SEQ_WRITE_BW ($SEQ_WRITE_IOPS IOPS)"
echo "Sequential Read: $SEQ_READ_BW ($SEQ_READ_IOPS IOPS)"
echo "Random Write: $RAND_WRITE_BW ($RAND_WRITE_IOPS IOPS)"
echo "Random Read: $RAND_READ_BW ($RAND_READ_IOPS IOPS)"
echo "=========================================="
---
# V1 Benchmark Job
apiVersion: batch/v1
kind: Job
metadata:
name: benchmark-v1
namespace: default
spec:
ttlSecondsAfterFinished: 3600
template:
metadata:
labels:
app: benchmark
engine: v1
spec:
restartPolicy: Never
containers:
- name: fio
image: ljishen/fio:latest
command: ["/bin/sh"]
args: ["/scripts/run-benchmarks.sh", "V1", "/data"]
resources:
requests:
cpu: "1"
memory: "2Gi"
limits:
cpu: "2"
memory: "4Gi"
volumeMounts:
- name: data
mountPath: /data
- name: scripts
mountPath: /scripts
securityContext:
runAsNonRoot: false
runAsUser: 0
capabilities:
drop:
- ALL
seccompProfile:
type: RuntimeDefault
volumes:
- name: data
persistentVolumeClaim:
claimName: benchmark-v1-pvc
- name: scripts
configMap:
name: v1-v2-benchmark-scripts
defaultMode: 0755
---
# V2 Benchmark Job
apiVersion: batch/v1
kind: Job
metadata:
name: benchmark-v2
namespace: default
spec:
ttlSecondsAfterFinished: 3600
template:
metadata:
labels:
app: benchmark
engine: v2
spec:
restartPolicy: Never
containers:
- name: fio
image: ljishen/fio:latest
command: ["/bin/sh"]
args: ["/scripts/run-benchmarks.sh", "V2", "/data"]
resources:
requests:
cpu: "1"
memory: "2Gi"
limits:
cpu: "2"
memory: "4Gi"
volumeMounts:
- name: data
mountPath: /data
- name: scripts
mountPath: /scripts
securityContext:
runAsNonRoot: false
runAsUser: 0
capabilities:
drop:
- ALL
seccompProfile:
type: RuntimeDefault
volumes:
- name: data
persistentVolumeClaim:
claimName: benchmark-v2-pvc
- name: scripts
configMap:
name: v1-v2-benchmark-scripts
defaultMode: 0755