Automated script for server performance test, with the below script just we have to run the performance and after the test we will have the results without any manual work and also we don’t need to spend our time with changing the parameters.

Feel free to comment if you have any questions ?

#!/bin/bash
serverlist=”client1 client2 ”

brokername=serverurl
username=admin
passwrd=admin
version=1.0.3
OutputType=”html”
ConsumerWaitTime=10000
csvLocationPC=”/app/report”
queueName=”sample”
threadCounts=”1″
timeout=1
msgSizes=”10″
copiedCSVsPath=”/app/csvs/”
resultFile=”/app/report/result.log”
DelayTime=10
totalDelayTime=$(((($timeout * 60)) + $DelayTime))

if [ $OutputType == “html” ]
then
echo “<!DOCTYPE html> <html><style> table, th, td { border: 1px solid black; } th,td {
padding: 5px; text-align: left; } </style> <body> <table style=width:100%><tr>
<th>TestCase</th> <th>MinLatency</th> <th>MaxLatency</th> <th>Median</th> <th>Ms
gCount</th> <th>Throughput</th> </tr>
” > $resultFile
else
echo “Result File ” > $resultFile
fi

for threadCount in $threadCounts
do
for msgSize in $msgSizes
do

for server in $serverlist
do ssh -oStrictHostKeyChecking=no app@$server java -jar /app/current/broker-performance-test-$version.jar $csvLocationPC/$server $brokername $queueName $username $passwrd $threadCount $timeout $msgSize $ConsumerWaitTime &
done

sleep $totalDelayTime

for server in $serverlist
do scp app@$server:$csvLocationPC/”$server”performanztest.csv $copiedCSVsPath
done

java -cp /app/current/broker-performance-test-$version.jar com.walmart.platform.performance.tibco.Calculate $copiedCSVsPath $timeout `echo $threadCount-$timeout-$msgSize` $OutputType >> $resultFile

for server in $serverlist
do ssh app@$server killall java
done

sleep 10

done #msgSize
done # threadCount
if [ $OutputType == “html” ]
then
echo “</table></body></html>”>> $resultFile
else
echo “End of the File ” >> $resultFile
fi
(echo -e “Subject: PerformanceTestResults\nContent-Type: text/html\nContent-Disposition: inline\n\n”;/bin/cat $resultFile) | /usr/sbin/sendmail -t admin@google.com
mail -s “Performance Test Results” admin@google.com < $resultFile

Leave a Reply