forked from RedHatSatellite/satellite-support
-
Notifications
You must be signed in to change notification settings - Fork 0
/
storage-benchmark
executable file
·143 lines (126 loc) · 4.06 KB
/
storage-benchmark
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
#!/bin/bash
###############################################################################
############################## README #########################################
#
# This script will execute a series of fio based IO tests against a targeted
# directory specified in its execution. This test will create a very large
# file that is double (2x) the size of the physical RAM on this system to
# ensure that we are not just testing the caching at the OS level of the
# storage.
#
# NOTE: We recommend you stop all services before executing this script and
# will be prompoted to do so.
#
# RESULTS: This test is meant to provide guidance and is not a hard-and-fast
# indicator of how your Satellite will perform. For more information please
# see this KCS here:
#
# https://access.redhat.com/solutions/3397771
#
# Generally you wish to see on average 100MB/sec or higher in the tests below.
# - Local SSD based storage should values of 600MB/sec or higher
# - Spinning disks should see values in the range of 100-200MB/sec or higher
# - If you see values below this, please open a support ticket for assistance.
#
###############################################################################
# Exit on any error
set -e
testlocation(){
mkdir -p $TESTDIRECTORY
echo ""
echo "Starting IO tests via the 'fio' command. This may take up to an hour or more"
echo "depending on the size of the files being tested. Be patient!"
echo ""
echo "************* Running READ test via fio:"
echo ""
fio --name=read-test --rw=read --size="$FILEGB"G --directory=$TESTDIRECTORY
echo ""
echo "************* Removing test files."
rm -f "$TESTDIRECTORY"/*
echo ""
echo "************* Running WRITE test via fio:"
fio --name=write-test --rw=write --size="$FILEGB"G --directory=$TESTDIRECTORY
echo ""
echo "************* Removing test files."
rm -f "$TESTDIRECTORY"/*
echo ""
echo "************* Running Random READ/WRITE test via fio:"
fio --name=randrw-test --rw=write --size="$FILEGB"G --directory=$TESTDIRECTORY --rwmixread=80
echo ""
echo "************* Removing test files."
rm -f "$TESTDIRECTORY"/*
echo ""
echo "Test complete! There is still a directory located : $TESTDIRECTORY that you"
echo "will need to remove to run this test again."
}
usage(){
echo "Please specify a path to test file IO against:"
echo ""
echo " # ./storage-benchmark /var/lib/pulp/"
echo ""
}
TESTPATH=$1
if [ -z $TESTPATH ]
then
usage
exit 1
fi
RAMGB=`grep MemTotal /proc/meminfo | awk '{s+=$2} END {print s / 1000000}'`
# Convert to integer
RAMGB=`printf "%.0f\n" "$RAMGB"`
FILEGB="$(($RAMGB * 2))"
TESTDIRECTORY=$TESTPATH/storage-benchmark
echo "This test creates a test file that is double (2X) the size of this system's"
echo "RAM in GB. This benchmark will create a test file of size.. "
echo ""
echo -e "\033[33;5;7m$FILEGB Gigabytes\033[0m"
echo ""
echo ".. in the: [$TESTDIRECTORY] location. This is to ensure that the test utilizes"
echo "a combination of cached and non-cached data during the test."
echo ""
echo "**** WARNING! Please verify you have enough free space to create a $FILEGB GB"
echo "file in this location before proceeding. "
echo ""
echo "Do you wish to proceed? (Y/N) "
read PROCEED
if [[ ! $PROCEED =~ ^[Yy]$ ]]
then
echo "** cancelled **"
exit 1
fi
if [ ! -x /usr/bin/fio ]
then
echo "This benchmark requires the 'fio' command be installed"
echo "Would you like to install it?"
read INSTALLFIO
if [[ ! $INSTALLFIO =~ ^[Yy]$ ]]
then
echo "** cancelled **"
exit 1
else
echo "** Installing fio **"
yum install -y fio
fi
fi
echo ""
echo "**** WARNING! We recommend you stop all Satellite 6 services to ensure no "
echo "interruption to critical processes."
echo ""
echo "Do you wish to stop Satellite 6 services? (Y/N) "
read STOPSERVICES
if [[ $STOPSERVICES =~ ^[Yy]$ ]]
then
echo ""
echo "Stopping services."
echo ""
foreman-maintain service stop
fi
testlocation
if [[ $STOPSERVICES =~ ^[Yy]$ ]]
then
echo ""
echo "Starting services."
echo ""
foreman-maintain service start
fi
echo "Finished."