Shital Savekar 2018-05-16 12:47:26 -07:00
Родитель 785940e3ce 1524f76fee
Коммит 1914880f95
5 изменённых файлов: 1002 добавлений и 4 удалений

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

@ -7671,7 +7671,46 @@
</TestParameters>
<Priority>P0</Priority>
</test>
<test>
<testName>ICA-PERF-DISKSPD-IO-TEST-4K</testName>
<testScript></testScript>
<testScriptps1>ICA-PERF-DISKSPD-IO-TEST.ps1</testScriptps1>
<setupType>DS14DISK12</setupType>
<SupportedExecutionModes>AzureServiceManagement,AzureResourceManager</SupportedExecutionModes>
<SubtestValues>SOME,TEXTS,NEEDS,TO,BE,PRESENT,HERE,FOR,PRINTING,TEST,SUMMARY</SubtestValues>
<files>.\remote-scripts\azuremodules.sh</files>
<TestParameters>
<param>modes='randread randwrite read write'</param>
<param>startThread=1</param>
<param>maxThread=1024</param>
<param>startIO=4</param>
<param>numjobs=1</param>
<param>ioruntime=300</param>
<param>maxIO=4</param>
<param>fileSize=1023G</param>
</TestParameters>
<Priority>P0</Priority>
</test>
<test>
<testName>ICA-PERF-DISKSPD-IO-TEST-1024K</testName>
<testScript></testScript>
<testScriptps1>ICA-PERF-DISKSPD-IO-TEST.ps1</testScriptps1>
<setupType>DS14DISK12</setupType>
<SupportedExecutionModes>AzureServiceManagement,AzureResourceManager</SupportedExecutionModes>
<SubtestValues>SOME,TEXTS,NEEDS,TO,BE,PRESENT,HERE,FOR,PRINTING,TEST,SUMMARY</SubtestValues>
<files>.\remote-scripts\azuremodules.sh</files>
<TestParameters>
<param>modes='randread randwrite read write'</param>
<param>startThread=1</param>
<param>maxThread=1024</param>
<param>startIO=1024</param>
<param>numjobs=1</param>
<param>ioruntime=300</param>
<param>maxIO=1024</param>
<param>fileSize=1023G</param>
</TestParameters>
<Priority>P0</Priority>
</test>
<test>
<testName>ICA-PERF-UDP-LOSS-TEST</testName>
<testScript></testScript>
@ -7730,8 +7769,6 @@
<Priority>P0</Priority>
</test>
<test>
<testName>ICA-IPERF3-TCP-IPV6-TEST</testName>
<testScript></testScript>
@ -7875,7 +7912,16 @@
<param>redis_test_suites="get,set"</param>
</TestParameters>
<Priority>P0</Priority>
</test>
</test>
<test>
<testName>ICA-PERF-SYSCALL-BENCHMARK-TEST</testName>
<testScript></testScript>
<testScriptps1>ICA-PERF-SYSCALL-BENCHMARK-TEST.ps1</testScriptps1>
<setupType>SingleVM</setupType>
<SupportedExecutionModes>AzureServiceManagement,AzureResourceManager</SupportedExecutionModes>
<SubtestValues>SOME,TEXTS,NEEDS,TO,BE,PRESENT,HERE,FOR,PRINTING,TEST,SUMMARY</SubtestValues>
<Priority>P0</Priority>
</test>
<test>
<testName>ICA-BUILD-LINUX-NEXT-DEB-PACKAGE</testName>
<testScript>build_deb_from_linux_next.sh</testScript>
@ -9293,6 +9339,21 @@
<Name>ICA-PERF-REDIS-MIDDLEWARE-TEST</Name>
</test>
</Cycle>
<Cycle>
<cycleName>PERF-DISKSPD</cycleName>
<test>
<Name>ICA-PERF-DISKSPD-IO-TEST-4K</Name>
</test>
<test>
<Name>ICA-PERF-DISKSPD-IO-TEST-1024K</Name>
</test>
</Cycle>
<Cycle>
<cycleName>PERF-SYSCALL</cycleName>
<test>
<Name>ICA-PERF-SYSCALL-BENCHMARK-TEST</Name>
</test>
</Cycle>
<Cycle>
<cycleName>LINUX-NEXT-DEB</cycleName>
<test>

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

@ -0,0 +1,209 @@
# This script deploys a VM with 12xP30 disks for DISKSPD IO test and trigger the test based on given buffer 4k/1024k.
#
# Author: Maruthi Sivakanth Rebba
# 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
{
$testVMData = $allVMData
ProvisionVMsForLisa -allVMData $allVMData -installPackagesOnRoleNames "none"
LogMsg "Generating constansts.sh ..."
$constantsFile = "$LogDir\constants.sh"
Set-Content -Value "#Generated by Azure Automation." -Path $constantsFile
foreach ( $param in $currentTestData.TestParameters.param)
{
Add-Content -Value "$param" -Path $constantsFile
LogMsg "$param added to constants.sh"
if ( $param -imatch "startThread" )
{
$startThread = [int]($param.Replace("startThread=",""))
}
if ( $param -imatch "maxThread" )
{
$maxThread = [int]($param.Replace("maxThread=",""))
}
}
LogMsg "constanst.sh created successfully..."
#endregion
#region EXECUTE TEST
$myString = @"
chmod +x perf_diskspd.sh
echo "Execution of script started.." > /root/runlog.txt
./perf_diskspd.sh &> diskspdConsoleLogs.txt
. azuremodules.sh
collect_VM_properties
"@
Set-Content "$LogDir\StartDiskSpdTest.sh" $myString
RemoteCopy -uploadTo $testVMData.PublicIP -port $testVMData.SSHPort -files ".\$constantsFile,.\remote-scripts\azuremodules.sh,.\remote-scripts\perf_diskspd.sh,.\$LogDir\StartDiskSpdTest.sh," -username "root" -password $password -upload
$out = RunLinuxCmd -ip $testVMData.PublicIP -port $testVMData.SSHPort -username "root" -password $password -command "chmod +x *.sh" -runAsSudo
$testJob = RunLinuxCmd -ip $testVMData.PublicIP -port $testVMData.SSHPort -username "root" -password $password -command "./StartDiskSpdTest.sh" -RunInBackground -runAsSudo
#endregion
#region MONITOR TEST
while ( (Get-Job -Id $testJob).State -eq "Running" )
{
$currentStatus = RunLinuxCmd -ip $testVMData.PublicIP -port $testVMData.SSHPort -username "root" -password $password -command "tail -1 runlog.txt"-runAsSudo
LogMsg "Current Test Staus : $currentStatus"
WaitFor -seconds 20
}
$finalStatus = RunLinuxCmd -ip $testVMData.PublicIP -port $testVMData.SSHPort -username "root" -password $password -command "cat state.txt"
RemoteCopy -downloadFrom $testVMData.PublicIP -port $testVMData.SSHPort -username "root" -password $password -download -downloadTo $LogDir -files "DiskSpdIOTest-*.tar.gz"
RemoteCopy -downloadFrom $testVMData.PublicIP -port $testVMData.SSHPort -username "root" -password $password -download -downloadTo $LogDir -files "*.txt, *.csv"
$testSummary = $null
#endregion
if ( $finalStatus -imatch "TestFailed")
{
LogErr "Test failed. Last known status : $currentStatus."
$testResult = "FAIL"
}
elseif ( $finalStatus -imatch "TestAborted")
{
LogErr "Test Aborted. Last known status : $currentStatus."
$testResult = "ABORTED"
}
elseif ( $finalStatus -imatch "TestCompleted")
{
LogMsg "Test Completed."
$testResult = "PASS"
}
elseif ( $finalStatus -imatch "TestRunning")
{
LogMsg "Powershell backgroud job for test is completed but VM is reporting that test is still running. Please check $LogDir\zkConsoleLogs.txt"
LogMsg "Contests of summary.log : $testSummary"
$testResult = "PASS"
}
LogMsg "Test result : $testResult"
LogMsg "Test Completed"
$resultSummary += CreateResultSummary -testResult $testResult -metaData "" -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
try
{
foreach($line in (Get-Content "$LogDir\DiskspdResults.csv"))
{
if ( $line -imatch "Iteration,TestType,BlockSize" )
{
$fioData = $true
}
if ( $fioData )
{
Add-Content -Value $line -Path $LogDir\diskspdData.csv
}
}
$diskspdDataCsv = Import-Csv -Path $LogDir\diskspdData.csv
LogMsg "Uploading the test results.."
$dataSource = $xmlConfig.config.Azure.database.server
$DBuser = $xmlConfig.config.Azure.database.user
$DBpassword = $xmlConfig.config.Azure.database.password
$database = $xmlConfig.config.Azure.database.dbname
$dataTableName = $xmlConfig.config.Azure.database.dbtable
$TestCaseName = $xmlConfig.config.Azure.database.testTag
if ($dataSource -And $DBuser -And $DBpassword -And $database -And $dataTableName)
{
$GuestDistro = cat "$LogDir\VM_properties.csv" | Select-String "OS type"| %{$_ -replace ",OS type,",""}
if ( $UseAzureResourceManager )
{
$HostType = "Azure-ARM"
}
else
{
$HostType = "Azure"
}
$HostBy = ($xmlConfig.config.Azure.General.Location).Replace('"','')
$HostOS = cat "$LogDir\VM_properties.csv" | Select-String "Host Version"| %{$_ -replace ",Host Version,",""}
$GuestOSType = "Linux"
$GuestDistro = cat "$LogDir\VM_properties.csv" | Select-String "OS type"| %{$_ -replace ",OS type,",""}
$GuestSize = $testVMData.InstanceSize
$KernelVersion = cat "$LogDir\VM_properties.csv" | Select-String "Kernel version"| %{$_ -replace ",Kernel version,",""}
$connectionString = "Server=$dataSource;uid=$DBuser; pwd=$DBpassword;Database=$database;Encrypt=yes;TrustServerCertificate=no;Connection Timeout=30;"
$SQLQuery = "INSERT INTO $dataTableName (TestCaseName,TestDate,HostType,HostBy,HostOS,GuestOSType,GuestDistro,GuestSize,KernelVersion,DiskSetup,BlockSize_KB,QDepth,seq_read_iops,seq_read_lat_avg,rand_read_iops,rand_read_lat_avg,seq_write_iops,seq_write_lat_avg,rand_write_iops,rand_write_lat_avg) VALUES "
for ( $QDepth = $startThread; $QDepth -le $maxThread; $QDepth *= 2 )
{
$seq_read_iops = ($diskspdDataCsv | where { $_.TestType -eq "sequential-read" -and $_.Threads -eq "$QDepth"} | Select ReadIOPS).ReadIOPS
$seq_read_lat_avg = ($diskspdDataCsv | where { $_.TestType -eq "sequential-read" -and $_.Threads -eq "$QDepth"} | Select ReadAvgLat).ReadAvgLat
$rand_read_iops = ($diskspdDataCsv | where { $_.TestType -eq "random-read" -and $_.Threads -eq "$QDepth"} | Select ReadIOPS).ReadIOPS
$rand_read_lat_avg = ($diskspdDataCsv | where { $_.TestType -eq "random-read" -and $_.Threads -eq "$QDepth"} | Select ReadAvgLat).ReadAvgLat
$seq_write_iops = ($diskspdDataCsv | where { $_.TestType -eq "sequential-write" -and $_.Threads -eq "$QDepth"} | Select WriteIOPS).WriteIOPS
$seq_write_lat_avg = ($diskspdDataCsv | where { $_.TestType -eq "sequential-write" -and $_.Threads -eq "$QDepth"} | Select WriteAvgLat).WriteAvgLat
$rand_write_iops = ($diskspdDataCsv | where { $_.TestType -eq "random-write" -and $_.Threads -eq "$QDepth"} | Select WriteIOPS).WriteIOPS
$rand_write_lat_avg= ($diskspdDataCsv | where { $_.TestType -eq "random-write" -and $_.Threads -eq "$QDepth"} | Select WriteAvgLat).WriteAvgLat
$BlockSize_KB= (($diskspdDataCsv | where { $_.Threads -eq "$QDepth"} | Select BlockSize)[0].BlockSize).Replace("K","")
$SQLQuery += "('$TestCaseName','$(Get-Date -Format yyyy-MM-dd)','$HostType','$HostBy','$HostOS','$GuestOSType','$GuestDistro','$GuestSize','$KernelVersion','RAID0:12xP30','$BlockSize_KB','$QDepth','$seq_read_iops','$seq_read_lat_avg','$rand_read_iops','$rand_read_lat_avg','$seq_write_iops','$seq_write_lat_avg','$rand_write_iops','$rand_write_lat_avg'),"
LogMsg "Collected performace data for $QDepth QDepth."
}
$SQLQuery = $SQLQuery.TrimEnd(',')
$connection = New-Object System.Data.SqlClient.SqlConnection
$connection.ConnectionString = $connectionString
$connection.Open()
$command = $connection.CreateCommand()
$command.CommandText = $SQLQuery
$result = $command.executenonquery()
$connection.Close()
LogMsg "Uploading the test results done!!"
}
else
{
LogMsg "Invalid database details. Failed to upload result to database!"
}
}
catch
{
$ErrorMessage = $_.Exception.Message
LogErr "EXCEPTION : $ErrorMessage"
}
}
catch
{
$ErrorMessage = $_.Exception.Message
LogMsg "EXCEPTION : $ErrorMessage"
}
Finally
{
$metaData = "NTTTCP RESULT"
if (!$testResult)
{
$testResult = "Aborted"
}
$resultArr += $testResult
}
}
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, $resultSummary

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

@ -0,0 +1,194 @@
# This script deploys the VM for the SYSCALL BENCHMARK test and trigger the test.
#
# Author: Maruthi Sivakanth Rebba
# 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
{
$testVMData = $allVMData
ProvisionVMsForLisa -allVMData $allVMData -installPackagesOnRoleNames "none"
#region EXECUTE TEST
$myString = @"
cd /root/
chmod +x perf_syscallBenchmark.sh
./perf_syscallBenchmark.sh &> syscallConsoleLogs.txt
. azuremodules.sh
collect_VM_properties
"@
Set-Content "$LogDir\StartSysCallBenchmark.sh" $myString
RemoteCopy -uploadTo $testVMData.PublicIP -port $testVMData.SSHPort -files ".\remote-scripts\azuremodules.sh,.\remote-scripts\perf_syscallBenchmark.sh,.\$LogDir\StartSysCallBenchmark.sh" -username "root" -password $password -upload
$out = RunLinuxCmd -ip $testVMData.PublicIP -port $testVMData.SSHPort -username "root" -password $password -command "chmod +x *.sh" -runAsSudo
$testJob = RunLinuxCmd -ip $testVMData.PublicIP -port $testVMData.SSHPort -username "root" -password $password -command "./StartSysCallBenchmark.sh" -RunInBackground -runAsSudo
#endregion
#region MONITOR TEST
while ( (Get-Job -Id $testJob).State -eq "Running" )
{
$currentStatus = RunLinuxCmd -ip $testVMData.PublicIP -port $testVMData.SSHPort -username "root" -password $password -command "tail -1 syscallConsoleLogs.txt"-runAsSudo
LogMsg "Current Test Staus : $currentStatus"
WaitFor -seconds 10
}
$finalStatus = RunLinuxCmd -ip $testVMData.PublicIP -port $testVMData.SSHPort -username "root" -password $password -command "cat state.txt"
$testSummary = $null
#endregion
if ( $finalStatus -imatch "TestFailed")
{
LogErr "Test failed. Last known status : $currentStatus."
$testResult = "FAIL"
}
elseif ( $finalStatus -imatch "TestAborted")
{
LogErr "Test Aborted. Last known status : $currentStatus."
$testResult = "ABORTED"
}
elseif ( $finalStatus -imatch "TestCompleted")
{
RemoteCopy -downloadFrom $testVMData.PublicIP -port $testVMData.SSHPort -username "root" -password $password -download -downloadTo $LogDir -files "syscall-benchmark-*.tar.gz"
RemoteCopy -downloadFrom $testVMData.PublicIP -port $testVMData.SSHPort -username "root" -password $password -download -downloadTo $LogDir -files "*.txt,*.log,*.csv"
LogMsg "Test Completed."
$testResult = "PASS"
}
elseif ( $finalStatus -imatch "TestRunning")
{
LogMsg "Powershell backgroud job for test is completed but VM is reporting that test is still running. Please check $LogDir\zkConsoleLogs.txt"
LogMsg "Contests of summary.log : $testSummary"
$testResult = "PASS"
}
try {
$logFilePath = "$LogDir\results.log"
$logs = Get-Content -Path $logFilePath
$vmInfo = Get-Content -Path $logFilePath | select -First 2
$logs = $logs.Split("`n")
Function GetResultObject ()
{
$Object = New-Object PSObject
$Object | add-member -MemberType NoteProperty -Name test -Value $null
$Object | add-member -MemberType NoteProperty -Name avgReal -Value $null
$Object | add-member -MemberType NoteProperty -Name avgUser -Value $null
$Object | add-member -MemberType NoteProperty -Name avgSystem -Value $null
return $Object
}
$mode = $null
$finalResult = @()
$finalResult += "********************************************************"
$finalResult += " SYSCALL BENCHMARK TEST RESULTS "
$finalResult += "***************************************************************************************"
$finalResult += $vmInfo
$currentResult = GetResultObject
foreach ($line in $logs)
{
if ( $line -imatch "bench_00_null_call_regs")
{
$currentResult.test = "bench_00_null_call_regs"
}
elseif ( $line -imatch "bench_01_null_call_stack")
{
$currentResult.test = "bench_01_null_call_stack"
}
elseif ( $line -imatch "bench_02_getpid_syscall")
{
$currentResult.test = "bench_02_getpid_syscall"
}
if ( $line -imatch "bench_03_getpid_vdso")
{
$currentResult.test = "bench_03_getpid_vdso"
}
elseif ( $line -imatch "bench_10_read_syscall")
{
$currentResult.test = "bench_10_read_syscall"
}
elseif ( $line -imatch "bench_11_read_vdso")
{
$currentResult.test = "bench_11_read_vdso"
}
elseif ( $line -imatch "bench_12_read_stdio")
{
$currentResult.test = "bench_12_read_stdio"
}
elseif ( $line -imatch "bench_20_write_syscall")
{
$currentResult.test = "bench_20_write_syscall"
}
elseif ( $line -imatch "bench_21_write_vdso")
{
$currentResult.test = "bench_21_write_vdso"
}
elseif ( $line -imatch "bench_22_write_stdio")
{
$currentResult.test = "bench_22_write_stdio"
}
elseif ( $line -imatch "average")
{
$testType = $currentResult.test
$currentResult.avgReal = $avgReal = $line.Split(" ")[2]
$currentResult.avgUser = $avgUser = $line.Split(" ")[4]
$currentResult.avgSystem = $avgSystem = $line.Split(" ")[6]
$finalResult += $currentResult
$metadata = "test=$testType"
$syscallResult = "AverageReal=$avgReal AverageUser=$avgUser AverageSystem=$avgSystem"
$resultSummary += CreateResultSummary -testResult "$syscallResult : Completed" -metaData $metadata -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
if ( $currentResult.test -imatch "bench_22_write_stdio")
{
LogMsg "Syscall results parsing is Done..."
break
}
$currentResult = GetResultObject
}
else{
continue
}
}
Set-Content -Value $finalResult -Path "$LogDir\syscalResults.txt"
LogMsg ($finalResult | Format-Table | Out-String)
}
catch{
$ErrorMessage = $_.Exception.Message
LogMsg "EXCEPTION : $ErrorMessage"
}
LogMsg "Test result : $testResult"
LogMsg "Test Completed"
}
catch
{
$ErrorMessage = $_.Exception.Message
LogMsg "EXCEPTION : $ErrorMessage"
}
Finally
{
$metaData = "SYSCALL BENCHMARK RESULT"
if (!$testResult)
{
$testResult = "Aborted"
}
$resultArr += $testResult
}
}
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, $resultSummary

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

@ -0,0 +1,385 @@
#!/bin/bash
##############################################################
# perf_diskspd.sh
# Author : Maruthi Sivakanth Rebba <v-sirebb@microsoft.com>
#
#Description:
# Download and run diskspd disk io performance tests.
##############################################################
ICA_TESTRUNNING="TestRunning" # The test is running
ICA_TESTCOMPLETED="TestCompleted" # The test completed successfully
ICA_TESTABORTED="TestAborted" # Error during the setup of the test
ICA_TESTFAILED="TestFailed" # Error occurred during the test
LogMsg()
{
echo "[$(date +"%x %r %Z")] ${1}"
echo "[$(date +"%x %r %Z")] ${1}" >> "${HOMEDIR}/runlog.txt"
}
UpdateTestState()
{
echo "${1}" > $HOMEDIR/state.txt
}
InstallDependencies() {
LogMsg "INFO: Dependency installation started..."
DISTRO=`grep -ihs "buntu\|Suse\|Fedora\|Debian\|CentOS\|Red Hat Enterprise Linux" /etc/{issue,*release,*version}`
if [[ $DISTRO =~ "Ubuntu" ]] || [[ $DISTRO =~ "Debian" ]];
then
LogMsg "INFO: Detected UBUNTU/Debian"
until dpkg --force-all --configure -a; sleep 10; do echo 'Trying again...'; done
apt-get update
apt-get install -y pciutils gawk mdadm
apt-get install -y wget sysstat blktrace bc gcc make libaio-dev g++ git
if [ $? -ne 0 ]; then
LogMsg "Error: Unable to install fio"
exit 1
fi
mount -t debugfs none /sys/kernel/debug
elif [[ $DISTRO =~ "Red Hat Enterprise Linux Server release 6" ]];
then
LogMsg "INFO: Detected RHEL 6.x"
LogMsg "INFO: installing required packages"
rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
yum -y --nogpgcheck install wget sysstat mdadm blktrace libaio gcc make libaio-dev g++ git
mount -t debugfs none /sys/kernel/debug
elif [[ $DISTRO =~ "Red Hat Enterprise Linux Server release 7" ]];
then
LogMsg "INFO: Detected RHEL 7.x"
LogMsg "INFO: installing required packages"
rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum -y --nogpgcheck install wget sysstat mdadm blktrace libaio gcc make libaio-dev g++ git
mount -t debugfs none /sys/kernel/debug
elif [[ $DISTRO =~ "CentOS Linux release 6" ]] || [[ $DISTRO =~ "CentOS release 6" ]];
then
LogMsg "INFO: Detected CentOS 6.x"
LogMsg "INFO: installing required packages"
rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
yum -y --nogpgcheck install wget sysstat mdadm blktrace libaio gcc make libaio-dev g++ git
mount -t debugfs none /sys/kernel/debug
elif [[ $DISTRO =~ "CentOS Linux release 7" ]];
then
LogMsg "INFO: Detected CentOS 7.x"
LogMsg "INFO: installing required packages"
rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum -y --nogpgcheck install wget sysstat mdadm blktrace libaio gcc make libaio-dev g++ git
mount -t debugfs none /sys/kernel/debug
elif [[ $DISTRO =~ "SUSE Linux Enterprise Server 12" ]];
then
LogMsg "INFO: Detected SLES12"
LogMsg "INFO: installing required packages"
zypper addrepo http://download.opensuse.org/repositories/benchmark/SLE_12_SP3_Backports/benchmark.repo
zypper --no-gpg-checks --non-interactive --gpg-auto-import-keys refresh
zypper --no-gpg-checks --non-interactive --gpg-auto-import-keys remove gettext-runtime-mini-0.19.2-1.103.x86_64
zypper --no-gpg-checks --non-interactive --gpg-auto-import-keys install sysstat
zypper --no-gpg-checks --non-interactive --gpg-auto-import-keys install grub2
zypper --no-gpg-checks --non-interactive --gpg-auto-import-keys install wget mdadm blktrace libaio1 gcc make libaio-dev g++ git
else
LogMsg "Error: Unknown Distro"
UpdateTestState "TestAborted"
UpdateSummary "Unknown Distro, test aborted"
return 1
fi
}
CreateRAID0()
{
disks=$(ls -l /dev | grep sd[c-z]$ | awk '{print $10}')
LogMsg "INFO: Check and remove RAID first"
mdvol=$(cat /proc/mdstat | grep "active raid" | awk {'print $1'})
if [ -n "$mdvol" ]; then
echo "/dev/${mdvol} already exist...removing first"
umount /dev/${mdvol}
mdadm --stop /dev/${mdvol}
mdadm --remove /dev/${mdvol}
mdadm --zero-superblock /dev/sd[c-z][1-5]
fi
LogMsg "INFO: Creating Partitions"
count=0
for disk in ${disks}
do
LogMsg "INFO: formatting disk /dev/${disk}"
echo "formatting disk /dev/${disk}"
(echo d; echo n; echo p; echo 1; echo; echo; echo t; echo fd; echo w;) | fdisk /dev/${disk}
count=$(( $count + 1 ))
sleep 1
done
LogMsg "INFO: Creating RAID of ${count} devices."
sleep 1
mdadm --create ${mdVolume} --level 0 --raid-devices ${count} /dev/sd[c-z][1-5]
sleep 1
time mkfs -t $1 -F ${mdVolume}
mkdir -p ${mountDir}
sleep 1
mount -o nobarrier ${mdVolume} ${mountDir}
if [ $? -ne 0 ]; then
LogMsg "Error: Unable to create raid"
exit 1
else
LogMsg "INFO: ${mdVolume} mounted to ${mountDir} successfully."
fi
}
CreateLVM()
{
disks=$(ls -l /dev | grep sd[c-z]$ | awk '{print $10}')
LogMsg "INFO: Check and remove LVM first"
vgExist=$(vgdisplay)
if [ -n "$vgExist" ]; then
umount ${mountDir}
lvremove -A n -f /dev/${vggroup}/lv1
vgremove ${vggroup} -f
fi
LogMsg "INFO: Creating Partition"
count=0
for disk in ${disks}
do
LogMsg "INFO: formatting disk /dev/${disk}"
echo "formatting disk /dev/${disk}"
(echo d; echo n; echo p; echo 1; echo; echo; echo t; echo fd; echo w;) | fdisk /dev/${disk}
count=$(( $count + 1 ))
done
LogMsg "INFO: Creating LVM with all data disks"
pvcreate /dev/sd[c-z][1-5]
vgcreate ${vggroup} /dev/sd[c-z][1-5]
lvcreate -l 100%FREE -i 12 -I 64 ${vggroup} -n lv1
time mkfs -t $1 -F /dev/${vggroup}/lv1
mkdir -p ${mountDir}
mount -o nobarrier /dev/${vggroup}/lv1 ${mountDir}
if [ $? -ne 0 ]; then
LogMsg "Error: Unable to create LVM "
exit 1
fi
}
InstallDiskSpd()
{
LogMsg "'diskspd' installation started..."
InstallDependencies
git clone https://github.com/Microsoft/diskspd-for-linux.git
cd diskspd-for-linux
make
make install
if [[ `which diskspd` == "" ]]
then
LogMsg "Error: 'diskspd' installation failed..."
exit -1
fi
}
DiskspdParser ()
{
if [[ $# != 2 ]];
then
LogMsg "Error: Usage $0 <output csv file name> <Absolute path to the diskspd logs folder>"
echo "Usage $0 <output csv file name> <Absolute path to the diskspd logs folder>"
exit 1
fi
csv_file=$1
logs_path=$2
csv_file_tmp=/tmp/temp.txt
echo $csv_file
rm -rf $csv_file_tmp $csv_file
echo "Iteration,TestType,BlockSize,Threads,Jobs,TotalIOPS,ReadIOPS,WriteIOPS,TotalBw(MBps),ReadBw(MBps),WriteBw(MBps),TotalAvgLat,ReadAvgLat,WriteAvgLat,TotalLatStdDev,ReadLatStdDev,WriteLatStdDev,IOmode" > $csv_file
out_list=(`ls $logs_path/*`)
count=0
while [ "x${out_list[$count]}" != "x" ]
do
file_name=${out_list[$count]}
Iteration=`cat $file_name| grep "Iteration:"| awk '{print $2}'| head -1`
Jobs=`cat $file_name| grep "number of outstanding"|awk '{print $6}'|head -1|sed s/[^0-9]//g`
ReadIOPS=`cat $file_name| grep "total:"|awk '{print $8}'|head -2 |tail -1`
ReadAvgLat=`cat $file_name| grep "total:"|awk '{print $12}'|head -2 |tail -1`
ReadLatStdDev=`cat $file_name| grep "total:"|awk '{print $14}'|head -2 |tail -1`
ReadBw=`cat $file_name| grep "total:"|awk '{print $6}'|head -2 |tail -1`
WriteIOPS=`cat $file_name| grep "total:"|awk '{print $8}'|tail -1`
WriteAvgLat=`cat $file_name| grep "total:"|awk '{print $12}'|tail -1`
WriteLatStdDev=`cat $file_name| grep "total:"|awk '{print $14}'|tail -1`
WriteBw=`cat $file_name| grep "total:"|awk '{print $6}'|tail -1`
BlockSize=`cat $file_name| grep "block size:"|awk '{print $3}'| awk '{printf "%d\n", $1/1024}'| head -1`K
mode=`cat $file_name| grep "performing"|awk '{print $6}'| sed s/[^0-9]//g`
testmode=""
if [[ $mode =~ "0100" ]];
then
testmode='write'
elif [[ $mode =~ "1000" ]];
then
testmode='read'
else
testmode='readwrite'
fi
TestType=`cat $file_name| grep "using.*:"|awk '{print $2}'| head -1`-$testmode
Threads=`cat $file_name| grep "total threads"|awk '{print $3}'`
TotalIOPS=`cat $file_name| grep "total:"|awk '{print $8}'|head -1`
TotalAvgLat=`cat $file_name| grep "total:"|awk '{print $12}'|head -1`
TotalLatStdDev=`cat $file_name| grep "total:"|awk '{print $14}'|head -1`
TotalBw=`cat $file_name| grep "total:"|awk '{print $6}'|head -1`
IOmode=`cat $file_name | grep "using O_"| sed "s/.*[a-z] //g" | tr '\n' ' - '`
echo "$Iteration,$TestType,$BlockSize,$Threads,$Jobs,$TotalIOPS,$ReadIOPS,$WriteIOPS,$TotalBw,$ReadBw,$WriteBw,$TotalAvgLat,$ReadAvgLat,$WriteAvgLat,$TotalLatStdDev,$ReadLatStdDev,$WriteLatStdDev,$IOmode" >> $csv_file_tmp
((count++))
done
cat $csv_file_tmp | sort -n| sed 's/^,,.*//' >> $csv_file
echo "Parsing completed!"
}
if [[ `which diskspd` == "" ]]
then
InstallDiskSpd
else
LogMsg "'diskspd' is already installed"
fi
# Execution of script starts from here
LogMsg "INFO: Execution of script Started..."
HOMEDIR="/root"
LOGDIR="$HOMEDIR/DiskspdLogs"
LOGFILE=$LOGDIR/diskspd.log
IOSTATLOGDIR="${LOGDIR}/iostatLog"
CONSTANTS_FILE="$HOMEDIR/constants.sh"
vggroup="vg1"
mountDir=/ioDiskTest
testfile=/ioDiskTest/testfile
if [ -d "$LOGDIR" ]; then
mv $LOGDIR $LOGDIR-$(date +"%m%d%Y-%H%M%S")/
fi
mkdir -p $LOGDIR/diskspdLog
mkdir -p $LOGDIR/iostatLog
mkdir -p $LOGDIR/blktraceLog
DISTRO=`grep -ihs "buntu\|Suse\|Fedora\|Debian\|CentOS\|Red Hat Enterprise Linux" /etc/{issue,*release,*version}`
if [[ $DISTRO =~ "SUSE Linux Enterprise Server 12" ]];
then
mdVolume="/dev/md/mdauto0"
else
mdVolume="/dev/md0"
fi
if [ -e ${CONSTANTS_FILE} ]; then
source ${CONSTANTS_FILE}
else
errMsg="Error: missing ${CONSTANTS_FILE} file"
LogMsg "${errMsg}"
LogMsg "INFO: NO test config provided, So test starting with default config.."
# These are supposed to be passed from constant.sh
modes='randread randwrite read write'
startThread=1
maxThread=1024
startIO=4
maxIO=1024
numjobs=1
fileSize=512G
ioruntime=300
fi
#Install required packages for test
InstallDependencies
#Creating RAID before triggering test
CreateRAID0 ext4
#CreateLVM ext4
# DiskSpd test will starts from here
LogMsg "*********INFO: Starting test execution*********"
UpdateTestState ICA_TESTRUNNING
iteration=0
io_increment=256
ulimitVal=51200
LogMsg "INFO: Preparing files for test..."
diskspd -w0 -b1M -o128 -t1 -c$fileSize -Sh -L $testfile >> ${HOMEDIR}/runlog.txt
LogMsg "INFO: Preparing files for test...done!"
for mode in $modes
do
testmode=""
if [[ $mode =~ "read" ]];
then
testmode='w0'
elif [[ $mode =~ "write" ]];
then
testmode='w100'
else
LogMsg "INFO: Unknown testmode: "$mode
fi
if [[ $mode =~ "rand" ]];
then
testmode="$testmode -r "
fi
io=$startIO
while [ $io -le $maxIO ]
do
Thread=$startThread
while [ $Thread -le $maxThread ]
do
if [ $Thread -ge 8 ]
then
numjobs=8
else
numjobs=$Thread
fi
iostatfilename="${IOSTATLOGDIR}/iostat-diskspd-${mode}-${io}K-${Thread}td.txt"
nohup iostat -x $ioruntime -t -y > $iostatfilename &
LOGFILE=$HOMEDIR/DiskspdLogs/diskspdLog/diskspd_b${io}K_${mode}_t${Thread}_o${numjobs}.log
CMD="diskspd -b${io}K -f$fileSize -$testmode -Sh -W2 -d$ioruntime -L -D -t$Thread -o$numjobs $testfile -xk"
LogMsg "INFO: Iteration: $iteration ,command: '$CMD'"
echo "Iteration: $iteration ,command: '$CMD'" > $LOGFILE
if [ $Thread -ge 1024 ]
then
ulimit -n $ulimitVal && ulimit -a && $CMD >> $LOGFILE
ulimitVal=$(( ulimitVal * 2 ))
ulimit -n 1024
else
ulimit -a && $CMD >> $LOGFILE
fi
iostatPID=`ps -ef | awk '/iostat/ && !/awk/ { print $2 }'`
kill -9 $iostatPID
Thread=$(( Thread*2 ))
iteration=$(( iteration+1 ))
sleep 1
done
io=$(( io * io_increment ))
done
done
# Parse DiskSpd results.
DiskspdParser $HOMEDIR/DiskspdResults.csv $HOMEDIR/DiskspdLogs/diskspdLog
# Compress all test logs.
compressedFileName="${HOMEDIR}/DiskSpdIOTest-$(date +"%m%d%Y-%H%M%S").tar.gz"
LogMsg "INFO: Please wait...Compressing all results to ${compressedFileName}..."
tar -cvzf $compressedFileName $LOGDIR/
UpdateTestState ICA_TESTCOMPLETED
LogMsg "*********INFO: Script execution reach END. Completed !!!*********"

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

@ -0,0 +1,149 @@
#!/bin/bash
#######################################################################
# perf_syscallBenchmark.sh
# Author : Maruthi Sivakanth Rebba <v-sirebb@microsoft.com>
#
# Description:
# Download and run syscall benchmark test.
#
# Supported Distros:
# Ubuntu, SUSE, RedHat, CentOS
#######################################################################
HOMEDIR="/root"
LogMsg()
{
echo "[$(date +"%x %r %Z")] ${1}"
echo "[$(date +"%x %r %Z")] ${1}" >> "${HOMEDIR}/syscallTestLog.txt"
}
LogMsg "Sleeping 10 seconds.."
sleep 10
#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
CONSTANTS_FILE="$HOMEDIR/constants.sh"
ICA_TESTRUNNING="TestRunning" # The test is running
ICA_TESTCOMPLETED="TestCompleted" # The test completed successfully
ICA_TESTABORTED="TestAborted" # Error during the setup of the test
ICA_TESTFAILED="TestFailed" # Error occurred during the test
UpdateTestState()
{
echo "${1}" > $HOMEDIR/state.txt
}
InstallDependencies() {
DISTRO=`grep -ihs "buntu\|Suse\|Fedora\|Debian\|CentOS\|Red Hat Enterprise Linux" /etc/{issue,*release,*version}`
if [[ $DISTRO =~ "Ubuntu" ]] || [[ $DISTRO =~ "Debian" ]];
then
LogMsg "Detected UBUNTU/Debian"
until dpkg --force-all --configure -a; sleep 10; do echo 'Trying again...'; done
apt-get update
apt-get install -y gcc yasm tar wget dos2unix git
if [ $? -ne 0 ]; then
LogMsg "Error: Unable to install SysCall required packages"
exit 1
fi
elif [[ $DISTRO =~ "Red Hat Enterprise Linux Server release 6" ]] || [[ $DISTRO =~ "Debian" ]];
then
LogMsg "Detected RHEL 6.x"
LogMsg "INFO: installing required packages"
rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
yum -y --nogpgcheck install gcc yasm tar wget dos2unix git
if [ $? -ne 0 ]; then
LogMsg "Error: Unable to install SysCall required packages"
exit 1
fi
elif [[ $DISTRO =~ "Red Hat Enterprise Linux Server release 7" ]];
then
LogMsg "Detected RHEL 7.x"
LogMsg "INFO: installing required packages"
rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum -y --nogpgcheck install gcc yasm tar wget dos2unix git
if [ $? -ne 0 ]; then
LogMsg "Error: Unable to install SysCall required packages"
exit 1
fi
elif [[ $DISTRO =~ "CentOS Linux release 6" ]] || [[ $DISTRO =~ "CentOS release 6" ]];
then
LogMsg "Detected CentOS 6.x"
LogMsg "INFO: installing required packages"
rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
yum -y --nogpgcheck install gcc yasm tar wget dos2unix git
if [ $? -ne 0 ]; then
LogMsg "Error: Unable to install SysCall required packages"
exit 1
fi
elif [[ $DISTRO =~ "CentOS Linux release 7" ]];
then
LogMsg "Detected CentOS 7.x"
LogMsg "INFO: installing required packages"
rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum -y --nogpgcheck install gcc yasm tar wget dos2unix git
if [ $? -ne 0 ]; then
LogMsg "Error: Unable to install SysCall required packages"
exit 1
fi
elif [[ $DISTRO =~ "SUSE Linux Enterprise Server 12" ]];
then
LogMsg "Detected SLES12"
zypper addrepo http://download.opensuse.org/repositories/benchmark/SLE_12_SP3_Backports/benchmark.repo
zypper --no-gpg-checks --non-interactive --gpg-auto-import-keys refresh
#zypper --no-gpg-checks --non-interactive --gpg-auto-import-keys remove gettext-runtime-mini-0.19.2-1.103.x86_64
zypper --no-gpg-checks --non-interactive --gpg-auto-import-keys install gcc yasm tar wget dos2unix git
if [ $? -ne 0 ]; then
LogMsg "Error: Unable to install SysCall required packages"
exit 1
fi
else
LogMsg "Unknown Distro"
UpdateTestState "TestAborted"
UpdateSummary "Unknown Distro, test aborted"
return 1
fi
}
runSysCallBenchmark()
{
UpdateTestState ICA_TESTRUNNING
#Syscall benchmark test start..
LogMsg "git clone SysCall benchmark started..."
git clone https://github.com/arkanis/syscall-benchmark.git
cd syscall-benchmark && ./compile.sh
if [ $? -ne 0 ]; then
LogMsg "Error: Unable to install SysCall check logs for more details."
exit 1
fi
LogMsg "INFO: SysCall benchmark install SUCCESS"
LogMsg "SysCall benchmark test started..."
./bench.sh
if [ $? -ne 0 ]; then
LogMsg "Error: SysCall benchmark test run FAILED"
exit 1
fi
LogMsg "INFO: SysCall benchmark test run SUCCESS"
cp $LOGDIR/results.log ${HOMEDIR}/
compressedFileName="${HOMEDIR}/syscall-benchmark-$(date +"%m%d%Y-%H%M%S").tar.gz"
LogMsg "INFO: Please wait...Compressing all results to ${compressedFileName}..."
tar -cvzf $compressedFileName ${HOMEDIR}/*.txt ${HOMEDIR}/*.log ${HOMEDIR}/*.csv $LOGDIR/
echo "Test logs are located at ${LOGDIR}"
UpdateTestState ICA_TESTCOMPLETED
}
############################################################
# Main body
############################################################
LogMsg "*********INFO: Starting test setup*********"
HOMEDIR=$HOME
mv $HOMEDIR/syscall-benchmark/ $HOMEDIR/syscall-benchmark-$(date +"%m%d%Y-%H%M%S")/
LOGDIR="${HOMEDIR}/syscall-benchmark"
cd ${HOMEDIR}
#Install required packages for SysCall benchmark
InstallDependencies
#Run SysCall benchmark test
LogMsg "*********INFO: Starting test execution*********"
runSysCallBenchmark
LogMsg "*********INFO: Script execution reach END. Completed !!!*********"