]>
Commit | Line | Data |
---|---|---|
302ef151 BB |
1 | #!/bin/bash |
2 | # | |
3 | # Wrapper script for easily running a survey of zpios based tests | |
4 | # | |
5 | ||
6 | basedir="$(dirname $0)" | |
7 | ||
8 | SCRIPT_COMMON=common.sh | |
9 | if [ -f "${basedir}/${SCRIPT_COMMON}" ]; then | |
10 | . "${basedir}/${SCRIPT_COMMON}" | |
11 | else | |
12 | echo "Missing helper script ${SCRIPT_COMMON}" && exit 1 | |
13 | fi | |
14 | ||
15 | PROG=zpios-survey.sh | |
16 | ||
17 | usage() { | |
18 | cat << EOF | |
19 | USAGE: | |
20 | $0 [hvp] <-c config> <-t test> | |
21 | ||
22 | DESCRIPTION: | |
23 | Helper script for easy zpios survey benchmarking. | |
24 | ||
25 | OPTIONS: | |
26 | -h Show this message | |
27 | -v Verbose | |
28 | -p Enable profiling | |
29 | -c Zpool configuration | |
30 | -t Zpios test | |
31 | -l Zpios survey log | |
32 | ||
33 | EOF | |
34 | } | |
35 | ||
36 | print_header() { | |
37 | tee -a ${ZPIOS_SURVEY_LOG} << EOF | |
38 | ||
39 | ================================================================ | |
40 | Test: $1 | |
41 | EOF | |
42 | } | |
43 | ||
44 | # Baseline performance for an out of the box config with no manual tuning. | |
45 | # Ideally, we want everything to be automatically tuned for your system and | |
46 | # for this to perform reasonably well. | |
47 | zpios_survey_base() { | |
48 | TEST_NAME="${ZPOOL_CONFIG}+${ZPIOS_TEST}+baseline" | |
49 | print_header ${TEST_NAME} | |
50 | ||
51 | ${ZFS_SH} ${VERBOSE_FLAG} | \ | |
52 | tee -a ${ZPIOS_SURVEY_LOG} | |
53 | ${ZPIOS_SH} ${VERBOSE_FLAG} -c ${ZPOOL_CONFIG} -t ${ZPIOS_TEST} | \ | |
54 | tee -a ${ZPIOS_SURVEY_LOG} | |
55 | ${ZFS_SH} -u ${VERBOSE_FLAG} | \ | |
56 | tee -a ${ZPIOS_SURVEY_LOG} | |
57 | } | |
58 | ||
59 | # Disable ZFS's prefetching. For some reason still not clear to me | |
60 | # current prefetching policy is quite bad for a random workload. | |
61 | # Allowing the algorithm to detect a random workload and not do | |
62 | # anything may be the way to address this issue. | |
63 | zpios_survey_prefetch() { | |
64 | TEST_NAME="${ZPOOL_CONFIG}+${ZPIOS_TEST}+prefetch" | |
65 | print_header ${TEST_NAME} | |
66 | ||
67 | ${ZFS_SH} ${VERBOSE_FLAG} \ | |
68 | tee -a ${ZPIOS_SURVEY_LOG} | |
69 | ${ZPIOS_SH} ${VERBOSE_FLAG} -c ${ZPOOL_CONFIG} -t ${ZPIOS_TEST} \ | |
70 | -o "--noprefetch" | \ | |
71 | tee -a ${ZPIOS_SURVEY_LOG} | |
72 | ${ZFS_SH} -u ${VERBOSE_FLAG} | \ | |
73 | tee -a ${ZPIOS_SURVEY_LOG} | |
74 | } | |
75 | ||
76 | # Simulating a zerocopy IO path should improve performance by freeing up | |
77 | # lots of CPU which is wasted move data between buffers. | |
78 | zpios_survey_zerocopy() { | |
79 | TEST_NAME="${ZPOOL_CONFIG}+${ZPIOS_TEST}+zerocopy" | |
80 | print_header ${TEST_NAME} | |
81 | ||
82 | ${ZFS_SH} ${VERBOSE_FLAG} | \ | |
83 | tee -a ${ZPIOS_SURVEY_LOG} | |
84 | ${ZPIOS_SH} ${VERBOSE_FLAG} -c ${ZPOOL_CONFIG} -t ${ZPIOS_TEST} \ | |
85 | -o "--zerocopy" | \ | |
86 | tee -a ${ZPIOS_SURVEY_LOG} | |
87 | ${ZFS_SH} -u ${VERBOSE_FLAG} | \ | |
88 | tee -a ${ZPIOS_SURVEY_LOG} | |
89 | } | |
90 | ||
91 | # Disabling checksumming should show some (if small) improvement | |
92 | # simply due to freeing up a modest amount of CPU. | |
93 | zpios_survey_checksum() { | |
94 | TEST_NAME="${ZPOOL_CONFIG}+${ZPIOS_TEST}+checksum" | |
95 | print_header ${TEST_NAME} | |
96 | ||
97 | ${ZFS_SH} ${VERBOSE_FLAG} | \ | |
98 | tee -a ${ZPIOS_SURVEY_LOG} | |
99 | ${ZPIOS_SH} ${VERBOSE_FLAG} -c ${ZPOOL_CONFIG} -t ${ZPIOS_TEST} \ | |
100 | -s "set checksum=off" | \ | |
101 | tee -a ${ZPIOS_SURVEY_LOG} | |
102 | ${ZFS_SH} -u ${VERBOSE_FLAG} | \ | |
103 | tee -a ${ZPIOS_SURVEY_LOG} | |
104 | } | |
105 | ||
106 | # Increasing the pending IO depth also seems to improve things likely | |
107 | # at the expense of latency. This should be explored more because I'm | |
108 | # seeing a much bigger impact there that I would have expected. There | |
109 | # may be some low hanging fruit to be found here. | |
110 | zpios_survey_pending() { | |
111 | TEST_NAME="${ZPOOL_CONFIG}+${ZPIOS_TEST}+pending" | |
112 | print_header ${TEST_NAME} | |
113 | ||
114 | ${ZFS_SH} ${VERBOSE_FLAG} \ | |
115 | zfs="zfs_vdev_max_pending=1024" | \ | |
116 | tee -a ${ZPIOS_SURVEY_LOG} | |
117 | ${ZPIOS_SH} ${VERBOSE_FLAG} -c ${ZPOOL_CONFIG} -t ${ZPIOS_TEST} | \ | |
118 | tee -a ${ZPIOS_SURVEY_LOG} | |
119 | ${ZFS_SH} -u ${VERBOSE_FLAG} | \ | |
120 | tee -a ${ZPIOS_SURVEY_LOG} | |
121 | } | |
122 | ||
302ef151 BB |
123 | # Apply all possible turning concurrently to get a best case number |
124 | zpios_survey_all() { | |
125 | TEST_NAME="${ZPOOL_CONFIG}+${ZPIOS_TEST}+all" | |
126 | print_header ${TEST_NAME} | |
127 | ||
128 | ${ZFS_SH} ${VERBOSE_FLAG} \ | |
ea04106b | 129 | zfs="zfs_vdev_max_pending=1024" | \ |
302ef151 BB |
130 | tee -a ${ZPIOS_SURVEY_LOG} |
131 | ${ZPIOS_SH} ${VERBOSE_FLAG} -c ${ZPOOL_CONFIG} -t ${ZPIOS_TEST} \ | |
132 | -o "--noprefetch --zerocopy" \ | |
133 | -s "set checksum=off" | \ | |
134 | tee -a ${ZPIOS_SURVEY_LOG} | |
135 | ${ZFS_SH} -u ${VERBOSE_FLAG} | \ | |
136 | tee -a ${ZPIOS_SURVEY_LOG} | |
137 | } | |
138 | ||
139 | ||
140 | PROFILE= | |
141 | ZPOOL_NAME=zpios-survey | |
142 | ZPOOL_CONFIG=zpool-config.sh | |
143 | ZPIOS_TEST=zpios-test.sh | |
144 | ZPIOS_SURVEY_LOG=/dev/null | |
145 | ||
146 | while getopts 'hvpc:t:l:' OPTION; do | |
147 | case $OPTION in | |
148 | h) | |
149 | usage | |
150 | exit 1 | |
151 | ;; | |
152 | v) | |
153 | VERBOSE=1 | |
154 | VERBOSE_FLAG="-v" | |
155 | ;; | |
156 | p) | |
157 | PROFILE=1 | |
158 | PROFILE_FLAG="-p" | |
159 | ;; | |
160 | c) | |
161 | ZPOOL_CONFIG=${OPTARG} | |
162 | ;; | |
163 | t) | |
164 | ZPIOS_TEST=${OPTARG} | |
165 | ;; | |
166 | l) | |
167 | ZPIOS_SURVEY_LOG=${OPTARG} | |
168 | ;; | |
169 | ?) | |
170 | usage | |
171 | exit | |
172 | ;; | |
173 | esac | |
174 | done | |
175 | ||
176 | if [ $(id -u) != 0 ]; then | |
177 | die "Must run as root" | |
178 | fi | |
179 | ||
180 | zpios_survey_base | |
181 | zpios_survey_prefetch | |
182 | zpios_survey_zerocopy | |
183 | zpios_survey_checksum | |
184 | zpios_survey_pending | |
302ef151 BB |
185 | zpios_survey_all |
186 | ||
187 | exit 0 |