-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrados-bench-gen
executable file
·192 lines (164 loc) · 5.33 KB
/
rados-bench-gen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
#!/bin/bash
##
# VARIABLES
##
TIME=$(date +"%Y-%m-%d_%H-%M")
RESULT_PATH=$HOME/rados-results/
SSH_OPTIONS="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
##
# FUNCTIONS
##
usage()
{
echo ""
echo "Usage: $0: [OPTIONS]"
echo " -c : Set number of concurrent I/O operations. Accepts several values separated by a comma."
echo " -b : Test block size, _MUST_ be set in BYTES. Accepts several values separated by a comma."
echo " -r : Set the pool replica count. Accepts several values separated by a comma."
echo " -p : Number of placement groups for the rados bench pool (help: (total_osds * 128)/(rep_size)"
echo " -t : Set the runtime in seconds"
echo " -z : Thread(s) in parallel"
echo " -s : List of the ceph servers. Accepts several values separated by a comma. (mandatory to flush the page between each run"
echo " -h : Show this help & exit"
echo ""
echo "Example:"
echo " $0 -c 16,32 -b 4096,4194304 -p 2048 -r 2,3 -t 600 -s server1,server2 -z 1,2"
echo ""
exit 1
}
while getopts 'c:b:p:t:r:s:z:h' OPTION
do
case ${OPTION} in
c)
CONCURRENCY="${OPTARG}"
;;
b)
IO_SIZE="${OPTARG}"
;;
p)
PG_NB="${OPTARG}"
;;
t)
RUNTIME="${OPTARG}"
;;
r)
REPLICA_COUNT="${OPTARG}"
;;
s)
HOSTS="${OPTARG}"
;;
z)
THREAD="${OPTARG}"
;;
h)
usage
;;
esac
done
##
# TESTS
##
if [ ! -d "${RESULT_PATH}" ]; then
mkdir -p ${RESULT_PATH}
fi
log()
{
echo $1 | tee -a ${RESULT_PATH}/output.log
}
drop_caches()
{
for h in $(echo ${HOSTS} | tr "," " ")
do
log "===> Dropping caches of the OSDs disks (`date +%H:%M:%S`)"
ssh ${SSH_OPTIONS} ${h} 'echo 3 > /proc/sys/vm/drop_caches'
done
}
ceph_health()
{
while [ "$(sudo ceph health)" != "HEALTH_OK" ] ; do
sleep 1
echo -n "."
done
}
job_duration()
{
DURATION=$(echo ${IO_SIZE} | tr "," " ")
DURATION="${DURATION} $(echo ${CONCURRENCY} | tr "," " ")"
DURATION="${DURATION} $(echo ${REPLICA_COUNT} | tr "," " ")"
DURATION=$(echo ${DURATION} | wc -w)
if [ $(echo ${IO_SIZE} | tr "," " " | wc -w) -eq 1 ]; then
DURATION=$((${DURATION} - 1))
fi
if [ $(echo ${CONCURRENCY} | tr "," " " | wc -w) -eq 1 ]; then
DURATION=$((${DURATION} - 1))
fi
if [ $(echo ${REPLICA_COUNT} | tr "," " " | wc -w) -eq 1 ]; then
DURATION=$((${DURATION} - 1))
fi
RUNTIME=$((${RUNTIME} * 2))
DURATION=$((${DURATION} * ${RUNTIME}))
echo ""
echo "THIS JOB IS ABOUT TO LAST FOR ${DURATION} SECONDS, PLEASE BE PATIENT"
echo ""
}
launch_rados()
{
# job_duration
for i in $(echo ${IO_SIZE} | tr "," " ")
do
for k in $(echo ${CONCURRENCY} | tr "," " ")
do
for l in $(echo ${REPLICA_COUNT} | tr "," " ")
do
mkdir -p ${RESULT_PATH}/${TIME}/${i}_${k}_${l}
CURRENT_TIME=$(date +%H:%M:%S)
LOGS=${RESULT_PATH}/${TIME}/${i}_${k}_${l}
drop_caches
log "===> CREATE POOL: ${CURRENT_TIME}_performance (`date +%H:%M:%S`)"
sudo ceph osd pool create ${CURRENT_TIME}_performance ${PG_NB} ${PG_NB}
if [ ${l} -gt 2 ]; then
ceph osd pool set ${CURRENT_TIME}_performance size ${l}
fi
echo -n "Waiting for Ceph to be ready..."
ceph_health
log "===> RADOS BENCH WRITE TEST WITH ${i} BYTES BLOCK SIZE, CONCURRENCY ${k} AND REPLICA COUNT ${l}: START (`date +%H:%M:%S`)"
for z in $(seq $(echo ${THREAD} | tr "," " "))
do
sudo rados -p ${CURRENT_TIME}_performance bench ${RUNTIME} write -b ${i} -t ${k} --no-cleanup > ${LOGS}/result_rados_write_${i}_${k}_${l}_thread${z}.csv &
PIDS="$PIDS $!"
done
while [ -n "$PIDS" ]; do
NEW_PIDS=
for p in $(echo $PIDS); do
if [ -d /proc/$p ]; then
NEW_PIDS="$NEW_PIDS $p"
fi
done
PIDS="$NEW_PIDS"
echo "Waiting for $PIDS"
sleep 5
done
log "===> RADOS BENCH WRITE TEST WITH ${i} BYTES BLOCK SIZE: END (`date +%H:%M:%S`)"
drop_caches
log "===> RADOS BENCH READ TEST WITH ${i} BYTES BLOCK SIZE AND CONCURRENCY ${k}: START (`date +%H:%M:%S`)"
sudo rados -p ${CURRENT_TIME}_performance bench ${RUNTIME} seq -t ${k} > ${LOGS}/result_rados_seq_${i}_${k}_${l}.csv bench
log "===> RADOS BENCH READ TEST WITH ${i} BYTES BLOCK SIZE: END (`date +%H:%M:%S`)"
sudo ceph osd pool delete ${CURRENT_TIME}_performance ${CURRENT_TIME}_performance --yes-i-really-really-mean-it
log "===> DELETE POOL: ${CURRENT_TIME}_performance (`date +%H:%M:%S`)"
sleep 5
done
done
done
}
launch_rbd()
{
echo "NOT IMPLEMENTED"
exit 1
}
##
# MAIN
##
# start the tests
log "Start: `date +%H:%M:%S`"
launch_rados
exit 0