blob: 74e88a31ce19258f1047ea75ee9ab832cd3a6ef9 (
plain) (
blame)
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
|
image="$(realpath "$1")"
test_directory=/tmp/performance_test
[ ! -z $2 ] && test_directory="$2"
test_time=20
image_directory="$(dirname "$image")"
dnbd3_rootfs_directory="$(dirname "${BASH_SOURCE[0]}")/../builder/dnbd3-rootfs"
log_directory="$(dirname "${BASH_SOURCE[0]}")/io_test_logs"
mountpoint_xmount="${test_directory}/mnt_xmount"
mountpoint="${test_directory}/mnt"
source ${dnbd3_rootfs_directory}/scripts/build.sh
if [[ ! -d "$test_directory" ]]; then
mkdir "$test_directory"
mkdir "$mountpoint_xmount"
mkdir "$mountpoint"
mkdir "$log_directory"
build_clean_xmount ${dnbd3_rootfs_directory}/binaries/xmount
build_clean_qemu_xmount ${dnbd3_rootfs_directory}/binaries/qemu-xmount
build_compile_xmount ${dnbd3_rootfs_directory}/binaries/xmount \
"/" "${test_directory}/xmount"
build_compile_qemu_xmount ${dnbd3_rootfs_directory}/binaries/qemu-xmount \
"${test_directory}/xmount"
cp ${dnbd3_rootfs_directory}/binaries/qemu-xmount/libxmount_input_qemu.so \
"${test_directory}/xmount/lib/xmount/"
fi
pushd "$log_directory"
dd_test() {
local device="$1"
size_in_megabyte="$2"
dd if="$device" of=/dev/null \
bs="$size_in_megabyte"M count=1\
iflag=direct \
2>&1 | grep bytes
}
fio_test() {
local device="$1"
shift
local name="$1"
shift
fio --readonly --name=job --direct=1 --write_bw_log="$name" \
--runtime=$test_time --filename="$device" "$@"
}
test_device() {
local device="$1"
local name="$2"
echo
#echo "-------------- $2 read test (dd)"
#dd_test "$device" 1000
echo "-------------- $2 read test (fio seq read)"
fio_test "$device" "$name.seq" --rw=read --ioengine=sync
echo "-------------- $2 read test (fio random read)"
fio_test "$device" "${name}.rand" --rw=randread --ioengine=sync
echo "-------------- $2 read test (fio seq read libaio)"
fio_test "$device" "${name}.seq_libaio" --rw=read --ioengine=libaio
echo "-------------- $2 read test (fio random read libaio)"
fio_test "$device" "${name}.rand_libaio" --rw=randread --ioengine=libaio
}
test_qemu() {
# qemu-nbd test (no cache)
modprobe nbd max_part=16
qemu_nbd_version="$( qemu-nbd --version \
| grep 'version' | cut --delimiter ' ' --field 3 )"
qemu-nbd --connect=/dev/nbd0 --read-only --persistent --nocache "$image"
#ln -s /dev/nbd0 "$image" # device as file (for dnbd3)
test_device "/dev/nbd0" "qemu-nbd $qemu_nbd_version (nocache)"
# qemu-nbd teardown
qemu-nbd -d /dev/nbd0 >/dev/null # disconnect
# qemu-nbd test
qemu-nbd --connect=/dev/nbd0 --read-only --persistent "$image"
test_device "/dev/nbd0" "qemu-nbd $qemu_nbd_version"
# qemu-nbd teardown
qemu-nbd -d /dev/nbd0 >/dev/null # disconnect
}
test_xmount() {
#xmount test
xmount_version="$( ${test_directory}/xmount/bin/xmount --info \
| grep 'xmount v' | cut --delimiter ' ' --field 2 )"
${test_directory}/xmount/bin/xmount --in qemu "$image" \
--out raw "${mountpoint_xmount}" \
loop_device="$(losetup -f)"
losetup "$loop_device" "${mountpoint_xmount}"/*.dd --partscan
test_device "$loop_device" "xmount ${xmount_version}"
# xmount teardown
losetup -d "$loop_device"
umount "$mountpoint_xmount"
#xmount test with writeback
${test_directory}/xmount/bin/xmount --in qemu "$image" \
--inopts bdrv_cache=writeback \
--out raw "${mountpoint_xmount}" \
loop_device="$(losetup -f)"
losetup "$loop_device" "${mountpoint_xmount}"/*.dd --partscan
test_device "$loop_device" "xmount ${xmount_version} with writeback"
# xmount teardown
losetup -d "$loop_device"
umount "$mountpoint_xmount"
}
test_qemu
test_xmount
chown $(who | awk '{print $1}') *.log
# bw logs
fio2gnuplot --gnuplot -p '*seq_bw*.log'
fio2gnuplot --gnuplot -p '*rand_bw*.log'
fio2gnuplot --gnuplot -p '*seq_libaio_bw*.log'
fio2gnuplot --gnuplot -p '*rand_libaio_bw*.log'
chown $(who | awk '{print $1}') *.png
rm *2Dsmooth*
rm *2Dtrend*
rm '$3.png'
popd
|