Skip to content

Commit 78c4d2e

Browse files
committed
Added mariadb standalone with topolvm
1 parent d46ab88 commit 78c4d2e

File tree

12 files changed

+381
-0
lines changed

12 files changed

+381
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Database benchmarks in Kubernetes
33

44
### Benchmarks
55

6+
- [mariadb-standalone-topolvm](./mariadb-standalone-topolvm/)
67
- [mariadb-replication-topolvm](./mariadb-replication-topolvm/)
78
- [mariadb-galera-topolvm](./mariadb-galera-topolvm/)
89

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
include ../make/base.mk
2+
3+
##@ MariaDB standalone on Topolvm
4+
5+
.PHONY: mariadb
6+
mariadb: kubectl ## Deploy MariaDB.
7+
$(KUBECTL) apply -f ./mariadb
8+
9+
.PHONY: maxscale
10+
maxscale: kubectl ## Deploy MaxScale.
11+
$(KUBECTL) apply -f ./maxscale
12+
13+
.PHONY: sysbench-sql
14+
sysbench-sql: kubectl ## Prepare sysbench SQL resources.
15+
$(KUBECTL) apply -f ./sql
16+
$(KUBECTL) wait --for=condition=ready database sbtest
17+
$(KUBECTL) wait --for=condition=ready user sbtest
18+
$(KUBECTL) wait --for=condition=ready grant sbtest
19+
20+
.PHONY: sysbench-prepare
21+
sysbench-prepare: kubectl sysbench-sql ## Prepare sysbench tests.
22+
$(KUBECTL) apply -f ./sysbench/sysbench-prepare-job.yaml
23+
24+
.PHONY: sysbench
25+
sysbench: kubectl ## Run sysbench tests.
26+
$(KUBECTL) apply -f ./sysbench/sysbench-cronjob.yaml
27+
$(KUBECTL) create job sysbench --from cronjob/sysbench
28+
29+
.PHONY: physicalbackup
30+
physicalbackup: kubectl ## Deploy PhysicalBackups.
31+
$(KUBECTL) apply -f ./physicalbackup
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# MariaDB standalone on Topolvm
2+
3+
```bash
4+
make mariadb
5+
make sysbench-prepare
6+
make sysbench
7+
make physicalbackup
8+
```
9+
10+
# sysbench
11+
12+
Threads: 4
13+
14+
MariaDB version: 11.8.2
15+
16+
MaxScale version: 23.08.5
17+
18+
### Standalone
19+
20+
```
21+
SQL statistics:
22+
queries performed:
23+
read: 6818490
24+
write: 1947659
25+
other: 973906
26+
total: 9740055
27+
transactions: 486871 (1622.88 per sec.)
28+
queries: 9740055 (32466.42 per sec.)
29+
ignored errors: 164 (0.55 per sec.)
30+
reconnects: 0 (0.00 per sec.)
31+
32+
General statistics:
33+
total time: 300.0029s
34+
total number of events: 486871
35+
36+
Latency (ms):
37+
min: 1.62
38+
avg: 2.46
39+
max: 214.22
40+
95th percentile: 2.97
41+
sum: 1199471.34
42+
43+
Threads fairness:
44+
events (avg/stddev): 121717.7500/89.67
45+
execution time (avg/stddev): 299.8678/0.00
46+
```
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: mariadb
5+
labels:
6+
k8s.mariadb.com/watch: ""
7+
stringData:
8+
password: MariaDB11!
9+
root-password: MariaDB11!
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
apiVersion: k8s.mariadb.com/v1alpha1
2+
kind: MariaDB
3+
metadata:
4+
name: mariadb
5+
spec:
6+
rootPasswordSecretKeyRef:
7+
name: mariadb
8+
key: root-password
9+
10+
# bootstrapFrom:
11+
# backupContentType: Physical
12+
# s3:
13+
# bucket: database
14+
# prefix: mariadb-standalone/physical
15+
# endpoint: minio.storage.svc.cluster.local:443
16+
# accessKeyIdSecretKeyRef:
17+
# name: minio
18+
# key: access-key-id
19+
# secretAccessKeySecretKeyRef:
20+
# name: minio
21+
# key: secret-access-key
22+
# tls:
23+
# enabled: true
24+
# caSecretKeyRef:
25+
# name: homelab-bundle
26+
# key: ca.crt
27+
# stagingStorage:
28+
# persistentVolumeClaim:
29+
# resources:
30+
# requests:
31+
# storage: 10Gi
32+
# accessModes:
33+
# - ReadWriteOnce
34+
# restoreJob:
35+
# resources:
36+
# requests:
37+
# cpu: 1
38+
# memory: 512Mi
39+
# limits:
40+
# cpu: 1
41+
# memory: 512Mi
42+
43+
storage:
44+
size: 30Gi
45+
storageClassName: topolvm
46+
47+
metrics:
48+
enabled: true
49+
50+
resources:
51+
requests:
52+
cpu: 4
53+
memory: 4Gi
54+
limits:
55+
cpu: 4
56+
memory: 4Gi
57+
58+
myCnf: |
59+
[mariadb]
60+
bind-address=*
61+
default_storage_engine=InnoDB
62+
binlog_format=row
63+
max_allowed_packet=1G
64+
innodb_autoinc_lock_mode=2
65+
innodb_buffer_pool_size=3200MB
66+
innodb_flush_method=O_DIRECT
67+
thread_handling=pool-of-threads
68+
thread_pool_size=4
69+
70+
tolerations:
71+
- effect: NoSchedule
72+
key: node.mmontes.io/type
73+
value: compute-large
74+
75+
affinity:
76+
antiAffinityEnabled: true
77+
nodeAffinity:
78+
requiredDuringSchedulingIgnoredDuringExecution:
79+
nodeSelectorTerms:
80+
- matchExpressions:
81+
- key: node.mmontes.io/type
82+
operator: In
83+
values:
84+
- compute-large
85+
86+
livenessProbe:
87+
failureThreshold: 10
88+
periodSeconds: 10
89+
timeoutSeconds: 5
90+
91+
readinessProbe:
92+
failureThreshold: 10
93+
periodSeconds: 10
94+
timeoutSeconds: 5
95+
96+
startupProbe:
97+
failureThreshold: 10
98+
periodSeconds: 10
99+
timeoutSeconds: 5
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
apiVersion: k8s.mariadb.com/v1alpha1
2+
kind: PhysicalBackup
3+
metadata:
4+
name: physicalbackup-s3
5+
spec:
6+
mariaDbRef:
7+
name: mariadb
8+
schedule:
9+
cron: "*/5 * * * *"
10+
suspend: false
11+
immediate: true
12+
compression: bzip2
13+
storage:
14+
s3:
15+
bucket: database
16+
prefix: mariadb-standalone/physical
17+
endpoint: minio.storage.svc.cluster.local:443
18+
accessKeyIdSecretKeyRef:
19+
name: minio
20+
key: access-key-id
21+
secretAccessKeySecretKeyRef:
22+
name: minio
23+
key: secret-access-key
24+
tls:
25+
enabled: true
26+
caSecretKeyRef:
27+
name: homelab-bundle
28+
key: ca.crt
29+
stagingStorage:
30+
persistentVolumeClaim:
31+
resources:
32+
requests:
33+
storage: 10Gi
34+
accessModes:
35+
- ReadWriteOnce
36+
timeout: 1h
37+
podAffinity: true
38+
tolerations:
39+
- effect: NoSchedule
40+
key: node.mmontes.io/type
41+
value: compute-large
42+
resources:
43+
requests:
44+
cpu: 1
45+
memory: 512Mi
46+
limits:
47+
cpu: 1
48+
memory: 512Mi
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
apiVersion: k8s.mariadb.com/v1alpha1
2+
kind: PhysicalBackup
3+
metadata:
4+
name: physicalbackup-snap
5+
spec:
6+
mariaDbRef:
7+
name: mariadb
8+
schedule:
9+
cron: "*/5 * * * *"
10+
suspend: false
11+
immediate: true
12+
maxRetention: 720h # 30 days
13+
storage:
14+
volumeSnapshot:
15+
volumeSnapshotClassName: topolvm
16+
timeout: 1h
17+
resources:
18+
requests:
19+
cpu: 1
20+
memory: 512Mi
21+
limits:
22+
memory: 512Mi
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: k8s.mariadb.com/v1alpha1
2+
kind: Database
3+
metadata:
4+
name: sbtest
5+
spec:
6+
mariaDbRef:
7+
name: mariadb
8+
characterSet: utf8
9+
collate: utf8_general_ci
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: k8s.mariadb.com/v1alpha1
2+
kind: Grant
3+
metadata:
4+
name: sbtest
5+
spec:
6+
mariaDbRef:
7+
name: mariadb
8+
privileges:
9+
- "ALL PRIVILEGES"
10+
database: sbtest
11+
table: "*"
12+
username: sbtest
13+
grantOption: false
14+
host: "%"
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: k8s.mariadb.com/v1alpha1
2+
kind: User
3+
metadata:
4+
name: sbtest
5+
spec:
6+
mariaDbRef:
7+
name: mariadb
8+
passwordSecretKeyRef:
9+
name: mariadb
10+
key: password
11+
host: "%"
12+
maxUserConnections: 1000000000

0 commit comments

Comments
 (0)