Added new test case for sysbench IO disk performance test

This commit is contained in:
SRIKKANTH 2016-01-12 17:30:22 +05:30
Родитель 190852d69e
Коммит f0c7b7734b
5 изменённых файлов: 5731 добавлений и 4952 удалений

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,147 @@
# This script deploys the VMs for the IO performance test and trigger the test.
# 1. sysstat sysbench mdadm and dos2unix must be installed in the test image
# Author: Sivakanth R
# Email : v-sirebb@microsoft.com
#
#####
<#-------------Create Deployment Start------------------#>
Import-Module .\TestLibs\RDFELibs.psm1 -Force
$result = ""
$testResult = ""
$resultArr = @()
$isDeployed = DeployVMS -setupType $currentTestData.setupType -Distro $Distro -xmlConfig $xmlConfig
if ($isDeployed)
{
try
{
$allVMData = GetAllDeployementData -DeployedServices $isDeployed
Set-Variable -Name AllVMData -Value $allVMData
$hs1VIP = $allVMData.PublicIP
$hs1ServiceUrl = $allVMData.URL
$hs1vm1IP = $allVMData.InternalIP
$hs1vm1Hostname = $allVMData.RoleName
$hs1vm1sshport = $allVMData.SSHPort
$hs1vm1tcpport = $allVMData.TCPtestPort
$hs1vm1udpport = $allVMData.UDPtestPort
RemoteCopy -uploadTo $hs1VIP -port $hs1vm1sshport -files $currentTestData.files -username $user -password $password -upload
RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command "mkdir code" -runAsSudo
RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command "cp *.sh code/" -runAsSudo
RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command "chmod +x code/*" -runAsSudo
$KernelVersion = RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command "uname -a" -runAsSudo
LogMsg "VM1 kernel version:- $KernelVersion"
$out = RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command "bash /home/$user/code/$($currentTestData.testScript) $user" -runAsSudo -runmaxallowedtime 7200
$raidStatus = RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command "cat /home/$user/code/iotest.log.txt | grep 'Raid mount: Success'" -runAsSudo
if ($raidStatus -imatch 'Raid mount: Success')
{
LogMsg "Raid is created Successfully and VM is ready for IOPerf test"
$restartvmstatus = RestartAllDeployments -allVMData $allVMData
if ($restartvmstatus -eq "True")
{
LogMsg "VMs Restarted Successfully"
WaitFor -seconds 120
$sysbenchStatus = RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command "cat /home/$user/code/sysbenchlog/sysbench.log.txt | grep 'Starting Run'" -runAsSudo
if ($sysbenchStatus -imatch "Starting Run")
{
LogMsg "Sysbench started creating files for io test.."
for($testDuration -le 260000)
{
$sysbenchStatus = RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command "pgrep -lf sysbench-full-io-test" -runAsSudo
if ($sysbenchStatus)
{
$iterationStatus = RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command "grep iteration /home/$user/code/sysbenchlog/sysbench.log.txt | tail -1" -runAsSudo -ignoreLinuxExitCode
LogMsg "Sysbench test is RUNNING.. `n $iterationStatus"
}
else{
WaitFor -seconds 30
$sysbenchStatus = RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command "pgrep -lf sysbench-full-io-test" -runAsSudo
if ($sysbenchStatus)
{
$iterationStatus = RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command "grep iteration /home/$user/code/sysbenchlog/sysbench.log.txt | tail -1" -runAsSudo -ignoreLinuxExitCode
LogMsg "Sysbench test is RUNNING.. `n $iterationStatus"
}
else{
$iotestStatus = RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command " cat /home/$user/code/sysbenchlog/sysbench.log.txt | grep 'SYSBENCH TEST COMPLETED' " -runAsSudo
if ($iotestStatus -imatch "SYSBENCH TEST COMPLETED")
{
LogMsg "Sysbench test is COMPLETED.."
$testResult = "PASS"
WaitFor -seconds 30
$logparserStatus = RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command " cat /home/$user/code/sysbenchlog/sysbench.log.txt | grep 'LOGPARSER COMPLETED' " -runAsSudo
if ($logparserStatus -imatch "LOGPARSER COMPLETED")
{
LogMsg "IO perf test and its log parser is COMPLETED.."
$testResult = "PASS"
break
}
else{
LogErr "IO perf test is COMPLETED.. and its log parser is FAILED.."
LogMsg "Check Log Parser and run manully for .csv file"
$testResult = "PASS"
break
}
}
else{
LogMsg "Sysbench test is ABORTED.."
$testResult = "Aborted"
Break
}
}
}
WaitFor -seconds 300
$testDuration=$testDuration+300
}
}
}
else{
LogMsg "VMs Restarts Failed.."
$testResult = "Aborted"
}
}
else{
LogErr "Raid is creation FAILED.. and IOPerf test is ABORTED"
$testResult = "Aborted"
}
LogMsg "Test result : $testResult"
}
catch
{
$ErrorMessage = $_.Exception.Message
LogMsg "EXCEPTION : $ErrorMessage"
}
Finally
{
$metaData = ""
if (!$testResult)
{
$testResult = "Aborted"
}
$resultArr += $testResult
#$resultSummary += CreateResultSummary -testResult $testResult -metaData $metaData -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName# if you want to publish all result then give here all test status possibilites. if you want just failed results, then give here just "FAIL". You can use any combination of PASS FAIL ABORTED and corresponding test results will be published!
}
}
else
{
$testResult = "Aborted"
$resultArr += $testResult
}
$result = GetFinalResultHeader -resultarr $resultArr
#Clean up the setup
#DoTestCleanUp -result $result -testName $currentTestData.testName -deployedServices $isDeployed -ResourceGroups $isDeployed
#Return the result and summery to the test suite script..
return $result

Просмотреть файл

@ -0,0 +1,55 @@
#!/bin/bash
#
# This script does the following:
# 1. Prepares the RAID with all the data disks attached
# 2. Places an entry for the created RAID in /etc/fstab.
# 3. Keep the sysbench test script in the startup for IO performance test.
#
# Author: Srikanth M
# Email : v-srm@microsoft.com
#
#####
username=$1
raidName="/dev/md1"
mountdir="/dataIOtest"
code_path="/home/$username/code"
LOGFILE="${code_path}/iotest.log.txt"
echo "IO test setup started.." >> $LOGFILE
list=(`fdisk -l | grep 'Disk.*/dev/sd[a-z]' |awk '{print $2}' | sed s/://| sort| grep -v "/dev/sd[ab]$" `)
count=0
while [ "x${list[count]}" != "x" ]
do
echo ${list[$count]} >> $LOGFILE
(echo n; echo p; echo 2; echo; echo; echo t; echo fd; echo w;) | fdisk ${list[$count]} >> $LOGFILE
count=$(( $count + 1 ))
done
lsblk >> $LOGFILE
echo "--- Raid $raidName creation started ---" >> $LOGFILE
(echo y)| mdadm --create $raidName --level 0 --raid-devices ${#list[@]} ${list[@]} >> $LOGFILE
if [ $? -ne 0 ]; then
echo "$raidName Raid creation: Failed" >> $LOGFILE
exit 80
fi
echo "$raidName Raid creation: Success" >> $LOGFILE
time mkfs.ext4 $raidName >> $LOGFILE
if [ $? -ne 0 ]; then
echo "$raidName Raid format: Failed" >> $LOGFILE
exit 80
fi
echo "$raidName Raid format: Success" >> $LOGFILE
mkdir $mountdir
uuid=`blkid $raidName| sed "s/.*UUID=\"//"| sed "s/\".*\"//"`
echo $uuid
echo "UUID=$uuid $mountdir ext4 defaults 0 2" >> /etc/fstab
mount -o nobarrier $raidName $mountdir
if [ $? -ne 0 ]; then
echo "$raidName Raid mount: Failed" >> $LOGFILE
exit 80
fi
echo "$raidName Raid mount: Success on $mountdir" >> $LOGFILE
df -hT >> $LOGFILE
cp $code_path/sysbench-full-io-test.sh $mountdir
bash $code_path/keep_cmds_in_startup.sh "cd $mountdir ; bash $mountdir/sysbench-full-io-test.sh $username &"

Просмотреть файл

@ -0,0 +1,116 @@
#!/bin/bash
#
# usage::-
# nohup bash sysbench-full-io-test.sh &
# or
#./sysbench-full-io-test.sh &
#
# For any info contact v-avchat@microsoft.com
set -u
set -x
#export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/share/oem/bin:/usr/share/oem/python/bin:/opt/bin
FILEIO="--test=fileio --file-total-size=134G --file-extra-flags=dsync --file-fsync-freq=0"
#FILEIO="--test=fileio --file-total-size=134G "
####################################
#All run config set here
#
username=$1
code_path="/home/$username/code"
mv $code_path/sysbenchlog/ $code_path/sysbenchlog-$(date +"%m%d%Y-%H%M%S")/
sleep 5
mkdir $code_path/sysbenchlog
LOGDIR="${code_path}/sysbenchlog"
LOGFILE="${LOGDIR}/sysbench.log.txt"
iteration=0
ioruntime=300
maxThread=1024
maxIo=8
#All possible values for file-test-mode are rndrd rndwr rndrw seqrd seqrewr
modes='rndrd rndwr rndrw seqrd seqrewr'
startThread=1
startIO=1
####################################
echo "Test log created at: ${LOGFILE}"
echo "===================================== Starting Run $(date +"%x %r %Z") ================================"
echo "===================================== Starting Run $(date +"%x %r %Z") script generated 2/9/2015 4:24:44 PM ================================" >> $LOGFILE
chmod 666 $LOGFILE
echo "Preparing Files: $FILEIO"
echo "Preparing Files: $FILEIO" >> $LOGFILE
# Remove any old files from prior runs (to be safe), then prepare a set of new files.
sysbench $FILEIO cleanup
echo "--- Disk Usage Before Generating New Files ---" >> $LOGFILE
df >> $LOGFILE
sysbench $FILEIO prepare
echo "--- Disk Usage After Generating New Files ---" >> $LOGFILE
df >> $LOGFILE
echo "=== End Preparation $(date +"%x %r %Z") ===" >> $LOGFILE
####################################
#Trigger run from here
for testmode in $modes; do
Thread=$startThread
while [ $Thread -le $maxThread ]
do
io=$startIO
while [ $io -le $maxIo ]
do
iostatfilename="${LOGDIR}/iostat-sysbench-${testmode}-${io}K-${Thread}.txt"
nohup iostat -x 5 -t -y > $iostatfilename &
echo "-- iteration ${iteration} ----------------------------- ${testmode}, ${io}K, ${Thread} threads, 5 minutes ------------------ $(date +"%x %r %Z") ---" >> $LOGFILE
sysbench $FILEIO --file-test-mode=$testmode --file-block-size=${io}"K" --max-requests=0 --max-time=$ioruntime --num-threads=$Thread run >> $LOGFILE
iostatPID=`ps -ef | awk '/iostat/ && !/awk/ { print $2 }'`
kill -9 $iostatPID
io=$(( io*2 ))
iteration=$(( iteration+1 ))
done
Thread=$(( Thread*2 ))
done
done
####################################
echo "===================================== Completed Run $(date +"%x %r %Z") script generated 2/9/2015 4:24:44 PM ================================" >> $LOGFILE
sysbench $FILEIO cleanup >> $LOGFILE
compressedFileName="SysbenchIOTest"$(date +"%m%d%Y-%H%M%S")".tar.gz"
echo "Please wait...Compressing all results to ${compressedFileName}..."
tar -cvzf $compressedFileName $LOGDIR/*.txt
mv $compressedFileName $LOGDIR/$compressedFileName
####################################
find_log_diff () {
LogMax=`(echo "l($1)/l(2)" | bc -l| sed 's/\..*$//')`
LogMin=`(echo "l($2)/l(2)" | bc -l| sed 's/\..*$//')`
diff=$(($LogMax - $LogMin + 1))
echo $diff
}
IO_difference=`find_log_diff $maxIo $startIO`
Thread_difference=`find_log_diff $maxThread $startThread`
Total_Modes=`echo $modes| wc -w`
total_iterations=$(($IO_difference * $Thread_difference *Total_Modes - 1))
echo $total_iterations
last_iteration=`tail -150 $LOGFILE | grep iteration| tail -1 | awk '{print $3}'`
if [ $last_iteration == $total_iterations ]
then
echo "SYSBENCH TEST COMPLETED" >> $LOGFILE
echo "SYSBENCH TEST COMPLETED"
else
echo "SYSBENCH TEST ABORTED" >> $LOGFILE
echo "SYSBENCH TEST ABORTED"
fi
####################################
bash $code_path/sysbench-log-parser.sh $LOGFILE
echo "Test logs are located at ${LOGDIR}"

Просмотреть файл

@ -0,0 +1,90 @@
#!/bin/bash
#
# This script converts Sysbench output file into csv format.
# Author : Srikanth M
# Email : v-srm@microsoft.com
####
syslog_file_name=$1
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <sysbench-output.log>" >&2
exit 1
fi
if [ ! -f $syslog_file_name ]; then
echo "$1: File not found!"
exit 1
fi
csv_file=`echo $syslog_file_name | sed s/\.log\.txt//`
csv_file=$csv_file.csv
echo $csv_file
TEMP_DIR='temp'
mkdir $TEMP_DIR
cat $syslog_file_name | grep "iteration "| awk '{print $3}' > $TEMP_DIR/res_Iteration.txt
cat $syslog_file_name | grep "iteration "| awk '{print $12 ":" $13 ":" $14}' > $TEMP_DIR/res_StartTime.txt
cat $syslog_file_name | grep "Number of threads:" | sed "s/Number of threads: //" > $TEMP_DIR/res_threads.txt
cat $syslog_file_name | grep "total file size"| sed "s/ total file size//" > $TEMP_DIR/res_FileSize.txt
cat $syslog_file_name | grep "Block size "| sed "s/Block size //" > $TEMP_DIR/res_BlockSize.txt
cat $syslog_file_name | grep "Using .* I/O mode" | sed 's/Using \(.*\) I\/O mode/\1/' > $TEMP_DIR/res_IOMode.txt
cat $syslog_file_name | grep "iteration"| awk '{print $5}'| sed s/,// > $TEMP_DIR/res_TestType.txt
cat $syslog_file_name | grep "Operations performed:"| awk '{print $3}'> $TEMP_DIR/res_ReadOperations.txt
cat $syslog_file_name | grep "Operations performed:"| awk '{print $5}'> $TEMP_DIR/res_WriteOperations.txt
cat $syslog_file_name | grep "Operations performed:"| awk '{print $7}'> $TEMP_DIR/res_OtherOperations.txt
cat $syslog_file_name | grep "Operations performed:"| awk '{print $10}' > $TEMP_DIR/res_TotalOperations.txt
cat $syslog_file_name | grep "Read "| awk '{print $2}' > $TEMP_DIR/res_ReadBytes.txt
cat $syslog_file_name | grep "Read "| awk '{print $4}' > $TEMP_DIR/res_WriteBytes.txt
cat $syslog_file_name | grep "Read "| awk '{print $7}' > $TEMP_DIR/res_TotalBytes.txt
cat $syslog_file_name | grep "Read " | awk '{print $8}' | sed s/\(//| sed s/\)// > $TEMP_DIR/res_Throughput.txt
cat $syslog_file_name | grep "Requests/sec executed"| awk '{print $1}'> $TEMP_DIR/res_IOPS.txt
cat $syslog_file_name | grep "total time: " | awk '{print $3}'| sed s/s// > $TEMP_DIR/res_TotalTime.txt
cat $syslog_file_name | grep "total number of events:" | awk '{print $5}' > $TEMP_DIR/res_TotalEvents.txt
cat $syslog_file_name | grep "min:" | awk '{print $2}' | sed s/ms// > $TEMP_DIR/res_MinLatency.txt
cat $syslog_file_name | grep "avg:" | awk '{print $2}' | sed s/ms// > $TEMP_DIR/res_AvgLatency.txt
cat $syslog_file_name | grep "max:" | awk '{print $2}' | sed s/ms// > $TEMP_DIR/res_MaxLatency.txt
cat $syslog_file_name | grep "approx. 95 percentile:" | awk '{print $4}' | sed s/ms// > $TEMP_DIR/res_PercentileLatency.txt
echo "Iteration,StartTime,Threads,FileSize,BlockSize,IOMode,TestType,ReadOperations,WriteOperations,OtherOperations,TotalOperations,ReadBytes,WriteBytes,TotalBytes,Throughput,IOPS,TotalTime(s),TotalEvents,MinLatency(ms),AvgLatency(ms),MaxLatency(ms), 95% PercentileLatency(ms)" > $csv_file
res_AvgLatency=(`cat $TEMP_DIR/res_AvgLatency.txt`)
res_BlockSize=(`cat $TEMP_DIR/res_BlockSize.txt`)
res_FileSize=(`cat $TEMP_DIR/res_FileSize.txt`)
res_IOMode=(`cat $TEMP_DIR/res_IOMode.txt`)
res_IOPS=(`cat $TEMP_DIR/res_IOPS.txt`)
res_Iteration=(`cat $TEMP_DIR/res_Iteration.txt`)
res_MaxLatency=(`cat $TEMP_DIR/res_MaxLatency.txt`)
res_MinLatency=(`cat $TEMP_DIR/res_MinLatency.txt`)
res_OtherOperations=(`cat $TEMP_DIR/res_OtherOperations.txt`)
res_PercentileLatency=(`cat $TEMP_DIR/res_PercentileLatency.txt`)
res_ReadBytes=(`cat $TEMP_DIR/res_ReadBytes.txt`)
res_ReadOperations=(`cat $TEMP_DIR/res_ReadOperations.txt`)
res_StartTime=(`cat $TEMP_DIR/res_StartTime.txt`)
res_TestType=(`cat $TEMP_DIR/res_TestType.txt`)
res_Throughput=(`cat $TEMP_DIR/res_Throughput.txt`)
res_TotalEvents=(`cat $TEMP_DIR/res_TotalEvents.txt`)
res_TotalOperations=(`cat $TEMP_DIR/res_TotalOperations.txt`)
res_TotalTime=(`cat $TEMP_DIR/res_TotalTime.txt`)
res_WriteBytes=(`cat $TEMP_DIR/res_WriteBytes.txt`)
res_WriteOperations=(`cat $TEMP_DIR/res_WriteOperations.txt`)
res_threads=(`cat $TEMP_DIR/res_threads.txt`)
res_TotalBytes=(`cat $TEMP_DIR/res_TotalBytes.txt`)
count=0
while [ "x${res_Iteration[$count]}" != "x" ]
do
echo ${res_Iteration[$count]}
echo "${res_Iteration[$count]}, ${res_StartTime[$count]}, ${res_threads[$count]}, ${res_FileSize[$count]}, ${res_BlockSize[$count]}, ${res_IOMode[$count]}, ${res_TestType[$count]}, ${res_ReadOperations[$count]}, ${res_WriteOperations[$count]}, ${res_OtherOperations[$count]}, ${res_TotalOperations[$count]}, ${res_ReadBytes[$count]}, ${res_WriteBytes[$count]}, ${res_TotalBytes[$count]}, ${res_Throughput[$count]}, ${res_IOPS[$count]}, ${res_TotalTime[$count]}, ${res_TotalEvents[$count]}, ${res_MinLatency[$count]}, ${res_AvgLatency[$count]}, ${res_MaxLatency[$count]}, ${res_PercentileLatency[$count]}, " >> $csv_file
((count++))
done
sed -i -e "s/rndrd/Random read/" $csv_file
sed -i -e "s/seqrd/Sequential read/" $csv_file
sed -i -e "s/seqrewr/Sequential write/" $csv_file
sed -i -e "s/rndwr/Random write/" $csv_file
echo "Output csv file: $csv_file created successfully."
echo "LOGPARSER COMPLETED."
rm -rf $TEMP_DIR