Added memcached server benchmark test as part for LISA perf tests on Azure

Supported Distros -
1. Ubuntu1510
2. CentOS71
This commit is contained in:
Shital Savekar 2016-02-22 20:58:00 +05:30
Родитель 390b02c81a
Коммит 57f70b0e5a
4 изменённых файлов: 667 добавлений и 3 удалений

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

@ -4932,7 +4932,6 @@
<SupportedExecutionModes>AzureServiceManagement,AzureResourceManager</SupportedExecutionModes>
<TestID>AzureRHUIStress_001</TestID>
</test>
<test>
<testName>ICA-PERF-ZOOKEEPER-TEST</testName>
<testScript></testScript>
@ -4954,7 +4953,19 @@
<remoteXML></remoteXML>
<Priority>P0</Priority>
</test>
<test>
<testName>ICA-PERF-MEMCACHED-BENCHMARK-TEST</testName>
<testScript></testScript>
<testScriptps1>ICA-PERF-MEMCACHED-BENCHMARK-TEST.ps1</testScriptps1>
<setupType>S2C1</setupType>
<SupportedExecutionModes>AzureServiceManagement,AzureResourceManager</SupportedExecutionModes>
<!--Remote Files will be directly downloaded to test VM.-->
<remoteFiles></remoteFiles>
<!--Remote XML will be downloaded to automation server for analysis-->
<remoteXML></remoteXML>
<SubtestValues>SOME,TEXTS,NEEDS,TO,BE,PRESENT,HERE,FOR,PRINTING,TEST,SUMMARY</SubtestValues>
<Priority>P0</Priority>
</test>
</testsDefinition>
<testCycles>
<!-- Setup related tests -->
@ -5685,7 +5696,12 @@
<Name>ICA-PERF-ZOOKEEPER-TEST</Name>
</test>
</Cycle>
<Cycle>
<cycleName>LISA-MEMC-PERF</cycleName>
<test>
<Name>ICA-PERF-MEMCACHED-BENCHMARK-TEST</Name>
</test>
</Cycle>
<Cycle>
<cycleName>LISA-PERF</cycleName>
<test>
@ -5700,6 +5716,9 @@
<test>
<Name>ICA-PERF-ZOOKEEPER-TEST</Name>
</test>
<test>
<Name>ICA-PERF-MEMCACHED-BENCHMARK-TEST</Name>
</test>
</Cycle>
<Cycle>

99
XML/Perf_memcached.xml Normal file
Просмотреть файл

@ -0,0 +1,99 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Linux on Hyper-V and Azure Test Code, ver. 1.0.0
Copyright (c) Microsoft Corporation
All rights reserved.
Licensed under the Apache License, Version 2.0 (the ""License"");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR
PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing
permissions and limitations under the License.
-->
<config>
<global>
<logfileRootDir>TestResults</logfileRootDir>
<defaultSnapshot>ICABase</defaultSnapshot>
<email>
<recipients>
<to>myself@mycompany.com</to>
</recipients>
<sender>myself@mycompany.com</sender>
<subject>LIS Performance Test Results</subject>
<smtpServer>mysmtphost.mycompany.com</smtpServer>
</email>
<!-- Optional testParams go here -->
<testParams>
<param>vmCpuNumber=4</param>
<param>vmMemory=8GB</param>
<param>ISO_OPTIONS=.\TestData\DistroISO\SLEs-12-Server-DVD-x86_64-GM-DVD1.iso,BOOT_IDE_FIRST</param>
</testParams>
</global>
<testSuites>
<suite>
<suiteName>MangoDbBenchmark</suiteName>
<suiteTests>
<suiteTest>Perf_MC_1Mil-100C</suiteTest>
</suiteTests>
</suite>
</testSuites>
<testCases>
<test>
<testName>Perf_MC_1Mil-100C</testName>
<testScript>performance_md.sh</testScript>
<files>remote-scripts/ica/performance_mc.sh</files>
<testParams>
<param>MC_VERSION=1.4.25</param>
<param>MC_SERVERS="Server1 Server2"</param>
<param>MC_CONCURRENCY=100</param>
<param>MC_EXECUTE_NUMBER=10000</param>
<param>MC_INITIAL_LOAD=1000</param>
</testParams>
<uploadFiles>
<file>mctest.log</file>
</uploadFiles>
<timeout>1200</timeout>
<OnError>Continue</OnError>
</test>
</testCases>
<VMs>
<vm>
<role>SUT1</role>
<hvServer>LIS-HOST01</hvServer>
<vmName>VM-MC-Client</vmName>
<os>Linux</os>
<ipv4></ipv4>
<sshKey>id_rsa.ppk</sshKey>
<suite>MangoDbBenchmark</suite>
<preStartConfig>
<file>.\setupscripts\Config-VM.ps1</file>
<file>.\setupscripts\Insert-ISO.ps1</file>
</preStartConfig>
</vm>
<vm>
<role>NonSUT1</role>
<hvServer>LIS-HOST02</hvServer>
<vmName>VM-MC-Server</vmName>
<os>Linux</os>
<ipv4></ipv4>
<sshKey>id_rsa.ppk</sshKey>
<preStartConfig>
<file>.\setupscripts\Config-VM.ps1</file>
<file>.\setupscripts\Insert-ISO.ps1</file>
</preStartConfig>
</vm>
</VMs>
</config>

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

@ -0,0 +1,187 @@
<#-------------Create Deployment Start------------------#>
Import-Module .\TestLibs\RDFELibs.psm1 -Force
$result = ""
$testResult = ""
$resultArr = @()
$isDeployed = DeployVMS -setupType $currentTestData.setupType -Distro $Distro -xmlConfig $xmlConfig
if ($isDeployed)
{
try
{
$noServer = $true
$noClient = $true
$mcSummary = $null
$serverMachines = @()
$MC_Servers = ""
foreach ( $vmData in $allVMData )
{
if ( $vmData.RoleName -imatch "Server" )
{
$serverMachines += $vmData
$noServer = $false
if ( $MC_Servers )
{
$MC_Servers += ",$($vmData.InternalIP):11211"
}
else
{
$MC_Servers ="$($vmData.InternalIP):11211"
}
}
elseif ( $vmData.RoleName -imatch "Client" )
{
$clientVMData = $vmData
$noClient = $fase
}
}
$MC_Servers = $MC_Servers.Trim()
if ( $noServer )
{
Throw "No any server VM defined. Be sure that, server VM role name matches with the pattern `"*server*`". Aborting Test."
}
if ( $noSlave )
{
Throw "No any client VM defined. Be sure that, client machine role names matches with pattern `"*client*`" Aborting Test."
}
#region CONFIGURE VMs for TEST
LogMsg "CLIENT VM details :"
LogMsg " RoleName : $($clientVMData.RoleName)"
LogMsg " Public IP : $($clientVMData.PublicIP)"
LogMsg " SSH Port : $($clientVMData.SSHPort)"
$i = 1
foreach ( $vmData in $serverMachines )
{
LogMsg "SERVER #$i VM details :"
LogMsg " RoleName : $($vmData.RoleName)"
LogMsg " Public IP : $($vmData.PublicIP)"
LogMsg " SSH Port : $($vmData.SSHPort)"
$i += 1
}
#
# PROVISION VMS FOR LISA WILL ENABLE ROOT USER AND WILL MAKE ENABLE PASSWORDLESS AUTHENTICATION ACROSS ALL VMS IN SAME HOSTED SERVICE.
#
ProvisionVMsForLisa -allVMData $allVMData -installPackagesOnRoleNames "DO-NOT-INSTALL"
#
foreach ( $vmData in $allVMData )
{
LogMsg "Adding $($vmData.InternalIP) $($vmData.RoleName) to /etc/hosts of $($clientVMData.RoleName) "
$out = RunLinuxCmd -ip $clientVMData.PublicIP -port $clientVMData.SSHPort -username "root" -password $password -command "echo $($vmData.InternalIP) $($vmData.RoleName) >> /etc/hosts"
}
#endregion
#region Geting Test Data from remote XML file
#$mcXMLURL = $($currentTestData.remoteXML)
#LogMsg "Downloading apache test XML : $mcXMLURL ..."
#$mcXMLFileName = $($mcXMLURL.Split("/")[$mcXMLURL.Split("/").Count-1])
#$out = Invoke-WebRequest -Uri $mcXMLURL -OutFile "$LogDir\$mcXMLFileName"
$mcXMLData = [xml](Get-Content -Path ".\XML\Perf_memcached.xml")
LogMsg "Generating constansts.sh ..."
$constantsFile = "$LogDir\constants.sh"
Set-Content -Value "#Generated by Azure Automation." -Path $constantsFile
foreach ($mcParam in $mcXMLData.config.testCases.test.testParams.param )
{
if ($mcParam -imatch "MC_SERVERS")
{
Add-Content -Value "MC_SERVERS=`"$MC_Servers`"" -Path $constantsFile
LogMsg "MC_SERVERS=$MC_Servers added to constansts.sh"
}
else
{
Add-Content -Value "$mcParam" -Path $constantsFile
LogMsg "$mcParam added to constansts.sh"
}
}
LogMsg "constanst.sh created successfully..."
#endregion
#region EXECUTE TEST
Set-Content -Value "/root/performance_mc.sh &> mcConsoleLogs.txt" -Path "$LogDir\StartMCTest.sh"
RemoteCopy -uploadTo $clientVMData.PublicIP -port $clientVMData.SSHPort -files ".\$constantsFile,.\remote-scripts\performance_mc.sh,.\$LogDir\StartMCTest.sh" -username "root" -password $password -upload
$out = RunLinuxCmd -ip $clientVMData.PublicIP -port $clientVMData.SSHPort -username "root" -password $password -command "chmod +x *.sh"
$testJob = RunLinuxCmd -ip $clientVMData.PublicIP -port $clientVMData.SSHPort -username "root" -password $password -command "/root/StartMCTest.sh" -RunInBackground
#endregion
#region MONITOR TEST
while ( (Get-Job -Id $testJob).State -eq "Running" )
{
$currentStatus = RunLinuxCmd -ip $clientVMData.PublicIP -port $clientVMData.SSHPort -username "root" -password $password -command "tail -n 1 /root/mcConsoleLogs.txt"
LogMsg "Current Test Staus : $currentStatus"
WaitFor -seconds 10
}
$finalStatus = RunLinuxCmd -ip $clientVMData.PublicIP -port $clientVMData.SSHPort -username "root" -password $password -command "cat /root/state.txt"
RemoteCopy -downloadFrom $clientVMData.PublicIP -port $clientVMData.SSHPort -username "root" -password $password -download -downloadTo $LogDir -files "/root/mcConsoleLogs.txt"
RemoteCopy -downloadFrom $clientVMData.PublicIP -port $clientVMData.SSHPort -username "root" -password $password -download -downloadTo $LogDir -files "/root/summary.log"
$mcConsoleLogs = (Get-Content "$LogDir\mcConsoleLogs.txt")
foreach ( $line in $mcConsoleLogs )
{
if ( $line -imatch "seconds to load data" )
{
$mcResult = $line.Trim()
}
}
$mcSummary = Get-Content -Path "$LogDir\summary.log" -ErrorAction SilentlyContinue
#endregion
if (!$mcSummary)
{
LogMsg "summary.log file is empty."
$mcSummary = "<EMPTY>"
}
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. Result : $mcResult."
$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\mcConsoleLogs.txt"
LogMsg "Contests of summary.log : $mcSummary"
$testResult = "PASS"
}
LogMsg "Test result : $testResult"
LogMsg "Test Completed"
}
catch
{
$ErrorMessage = $_.Exception.Message
LogMsg "EXCEPTION : $ErrorMessage"
}
Finally
{
$metaData = ""
if (!$testResult)
{
$testResult = "Aborted"
}
$resultArr += $testResult
$resultSummary += CreateResultSummary -testResult $mcResult -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, $resultSummary

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

@ -0,0 +1,359 @@
#!/bin/bash
########################################################################
#
# Linux on Hyper-V and Azure Test Code, ver. 1.0.0
# Copyright (c) Microsoft Corporation
#
# All rights reserved.
# Licensed under the Apache License, Version 2.0 (the ""License"");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
#
# THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
# OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
# ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR
# PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT.
#
# See the Apache Version 2.0 License for specific language governing
# permissions and limitations under the License.
#
########################################################################
#######################################################################
#
# performance_mc.sh
#
# Description:
# This tool uses the memslap to Load testing and benchmarking a server
# More info : http://docs.libmemcached.org/bin/memaslap.html
#
#
# In general the script does the following:
#
# 1.Install memcached server on mentioned servers and starts memcached server service.
# 2.Benchmarks mem servers with memslap tool.
#
# Parameters:
# MC_VERSION=1.4.25
# MC_SERVERS="Server1:11211,Server2:11211"
# MC_CONCURRENCY=10
# MC_EXECUTE_NUMBER=10000
# MC_INITIAL_LOAD=1000
#######################################################################
ICA_TESTRUNNING="TestRunning"
ICA_TESTCOMPLETED="TestCompleted"
ICA_TESTABORTED="TestAborted"
ICA_TESTFAILED="TestFailed"
#
# Function definitions
#
LogMsg()
{
echo `date "+%a %b %d %T %Y"` ": ${1}"
}
UpdateTestState()
{
echo $1 > ~/state.txt
}
#######################################################################
#
# LinuxRelease()
#
#######################################################################
LinuxRelease()
{
DISTRO=`grep -ihs "buntu\|Suse\|Fedora\|Debian\|CentOS\|Red Hat Enterprise Linux" /etc/{issue,*release,*version}`
case $DISTRO in
*buntu*)
echo "UBUNTU";;
Fedora*)
echo "FEDORA";;
CentOS*)
echo "CENTOS";;
*SUSE*)
echo "SLES";;
Red*Hat*)
echo "RHEL";;
Debian*)
echo "DEBIAN";;
esac
}
######################################################################
#
# Description:
# Perform distro specific memcached configuratoin and tool installation steps
# and then run the benchmark tool
#
#######################################################################
ConfigUbuntuMemC()
{
#
# Note: A number of steps will use SSH to issue commands to the
# MC_SERVER. This requires that the SSH keys be provisioned
# in advanced, and strict mode be disabled for both the SSH
# server and client.
#
LogMsg "Info: Running Ubuntu Config on client VM."
LogMsg "Checking if memcached is installed or not.."
memcslapInstalled=`which memcslap`
if [ ! $javaInstalled ]; then
LogMsg "Installing memcslap"
apt-get -y install libmemcached-tools
if [ $? -ne 0 ]; then
LogMsg "Error: Unable to install memcslap"
UpdateTestState $ICA_TESTFAILED
exit 1
fi
LogMsg "memcslap installed on client."
fi
arr=$(echo $MC_SERVERS | tr "," "\n")
for MCS in $arr
do
currentServer=${MCS/:11211/}
LogMsg "Info: -----------------------------------------"
LogMsg "Info: memcached server installation on server ${currentServer}"
ssh root@${currentServer} "apt-get install -y memcached"
ssh root@${currentServer} "sed --in-place -e 's/-l 127.0.0.1//g' /etc/memcached.conf"
ssh root@${currentServer} "service memcached restart"
if [ $? -ne 0 ]; then
msg="Error: Unable to install package to server ${currentServer}"
LogMsg "${msg}"
echo "${msg}" >> ./summary.log
UpdateTestState $ICA_TESTFAILED
exit 1
fi
LogMsg "Info: memcached Server started successfully on ${currentServer}"
done
}
ConfigRHELMemC()
{
LogMsg "Info: Running CENTOS/RHEL Config on client VM."
LogMsg "Checking if memcached is installed or not.."
memslap --help > /dev/null
if [ $? -ne 0 ]; then
LogMsg "Installing memslap"
yum install -y libmemcached
if [ $? -ne 0 ]; then
LogMsg "Error: Unable to install memcslap"
UpdateTestState $ICA_TESTFAILED
exit 1
fi
LogMsg "memslap installed on client."
fi
arr=$(echo $MC_SERVERS | tr "," "\n")
for MCS in $arr
do
currentServer=${MCS/:11211/}
LogMsg "Info: -----------------------------------------"
LogMsg "Info: memcached server installation on server ${currentServer}"
ssh root@${currentServer} "yum install -y memcached"
ssh root@${currentServer} "service memcached restart"
if [ $? -ne 0 ]; then
msg="Error: Unable to install package to server ${currentServer}"
LogMsg "${msg}"
echo "${msg}" >> ./summary.log
UpdateTestState $ICA_TESTFAILED
exit 1
fi
LogMsg "Info: memcached Server started successfully on ${currentServer}"
done
}
ConfigRHELMemSlap()
{
#
# Note: MemSlap is client for memcached to benchmark memcached server.
# This is long running client so far.
#
LogMsg "Info: Running RHEL"
LogMsg "Info: -----------------------------------------"
LogMsg "Info: memslap installation"
LogMsg "Info: Installing required packages first"
yum install -y wget gcc make gcc-c++
if [ $? -ne 0 ]; then
msg="Error: Unable to install client packages"
LogMsg "${msg}"
echo "${msg}" >> ./summary.log
UpdateTestState $ICA_TESTFAILED
exit 1
fi
LogMsg "Info: Download memslap package"
pkg=(`ssh root@${SERVER} "ls /root/ | grep ${MEMSLAP_VERSION}"`)
echo $pkg
if [ -z "$pkg" ]; then
LogMsg "Downloading memslap package ${MEMSLAP_VERSION}"
#exit 1
wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz
if [ $? -ne 0 ]; then
msg="Error: Unable to download memslap package"
LogMsg "${msg}"
echo "${msg}" >> ./summary.log
UpdateTestState $ICA_TESTFAILED
exit 1
fi
fi
LogMsg "Info: Untar and Config ZK server"
tar -xvzf libmemcached-1.0.18.tar.gz
cd libmemcached-1.0.18/
./configure
make
make install
if [ $? -ne 0 ]; then
msg="Error: Unable install memslap"
LogMsg "${msg}"
echo "${msg}" >> ./summary.log
UpdateTestState $ICA_TESTFAILED
exit 1
fi
LogMsg "Info: memslap client setup successfully"
}
#######################################################################
#
# Main script body
#
#######################################################################
cd ~
UpdateTestState $ICA_TESTRUNNING
LogMsg "Starting test"
#
# Delete any old summary.log file
#
LogMsg "Cleaning up old summary.log"
if [ -e ~/summary.log ]; then
rm -f ~/summary.log
fi
touch ~/summary.log
#
# Source the constants.sh file
#
LogMsg "Sourcing constants.sh"
if [ -e ~/constants.sh ]; then
. ~/constants.sh
else
msg="Error: ~/constants.sh does not exist"
LogMsg "${msg}"
echo "${msg}" >> ~/summary.log
UpdateTestState $ICA_TESTABORTED
exit 10
fi
#
# Make sure the required test parameters are defined
#
if [ "${MC_VERSION:="UNDEFINED"}" = "UNDEFINED" ]; then
msg="Error: the MC_VERSION test parameter is missing"
LogMsg "${msg}"
echo "${msg}" >> ~/summary.log
UpdateTestState $ICA_TESTFAILED
exit 20
fi
if [ "${MC_SERVERS:="UNDEFINED"}" = "UNDEFINED" ]; then
msg="Error: the MC_SERVER test parameter is missing"
LogMsg "${msg}"
echo "${msg}" >> ~/summary.log
UpdateTestState $ICA_TESTFAILED
exit 20
fi
if [ "${MC_CONCURRENCY:="UNDEFINED"}" = "UNDEFINED" ]; then
msg="Error: the MC_CONCURRENCY test parameter is missing"
LogMsg "${msg}"
echo "${msg}" >> ~/summary.log
MC_CONCURRENCY=100
fi
if [ "${MC_EXECUTE_NUMBER:="UNDEFINED"}" = "UNDEFINED" ]; then
msg="Error: the MC_EXECUTE_NUMBER test parameter is missing"
LogMsg "${msg}"
echo "${msg}" >> ~/summary.log
MC_EXECUTE_NUMBER=10000
fi
if [ "${MC_INITIAL_LOAD:="UNDEFINED"}" = "UNDEFINED" ]; then
msg="Error: the MC_INITIAL_LOAD test parameter is missing"
LogMsg "${msg}"
echo "${msg}" >> ~/summary.log
MC_INITIAL_LOAD=10000
fi
LogMsg "Info: Test run parameters"
echo "MC_VERSION = ${MC_VERSION}"
echo "MC_SERVERS = ${MC_SERVERS}"
echo "MC_CONCURRENCY = ${MC_CONCURRENCY}"
echo "MC_EXECUTE_NUMBER = ${MC_EXECUTE_NUMBER}"
echo "MC_INITIAL_LOAD = ${MC_INITIAL_LOAD}"
#
# Configure MC server - this has distro specific behaviour
#
distro=`LinuxRelease`
case $distro in
"CENTOS" | "RHEL")
ConfigRHELMemC
testString="memslap --servers=${MC_SERVERS} --concurrency=${MC_CONCURRENCY} --execute-number=${MC_EXECUTE_NUMBER} --initial-load=${MC_INITIAL_LOAD} --flush"
;;
"UBUNTU")
ConfigUbuntuMemC
testString="memcslap --servers=${MC_SERVERS} --concurrency=${MC_CONCURRENCY} --execute-number=${MC_EXECUTE_NUMBER} --initial-load=${MC_INITIAL_LOAD} --flush"
;;
"DEBIAN")
LogMsg "Debian distro not yet supported"
#ConfigDebianMemC
;;
"SLES")
LogMsg "SLES distro not yet supported"
#ConfigSlesMemC
;;
*)
msg="Error: Distro '${distro}' not supported"
LogMsg "${msg}"
echo "${msg}" >> ~/summary.log
UpdateTestState "TestAborted"
exit 1
;;
esac
LogMsg "Running memslap tests with cmd: ${testString}"
eval $testString
if [ $? -ne 0 ]; then
msg="Error: Error in running tests"
LogMsg "${msg}"
echo "${msg}" >> ./summary.log
UpdateTestState $ICA_TESTFAILED
exit 1
fi
#
# If we made it here, everything worked.
# Indicate success
#
LogMsg "Test completed successfully"
UpdateTestState $ICA_TESTCOMPLETED
exit 0