Created
June 7, 2012 21:09
-
-
Save daniel-garcia/2891540 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/bash | |
LOG_FILE=sysbench_driver.log | |
rm -f $LOG_FILE | |
SYSBENCH=`which sysbench` | |
rc=$? | |
if [[ $rc != 0 ]]; then | |
echo "I could not find sysbench in the path." | |
exit $rc | |
fi | |
HOSTNAME=`hostname` | |
REPORT_EMAIL="[email protected]" | |
# get cpu information | |
echo "starting benchmark on `date`" >> $LOG_FILE | |
echo "host: $HOSTNAME" | |
echo "=============== CPU INFO ================" >> $LOG_FILE | |
cat /proc/cpuinfo >> $LOG_FILE | |
ZENDS_CNF=/opt/zends/etc/zends.cnf | |
if [ -f $ZENDS_CNF ]; then | |
echo "=============== ZENDS.CNF ================" >> $LOG_FILE | |
cat $ZENDS_CNF >> $LOG_FILE | |
fi | |
THREAD_RUNS="1 2 4 8 16" | |
for threads in $THREAD_RUNS | |
do | |
echo "=============== CPU BENCH $threads ================" >> $LOG_FILE | |
cmd="sysbench --test=cpu --cpu-max-prime=20000 --num-threads=$threads run" | |
echo $cmd | tee -a $LOG_FILE | |
sysbench --test=cpu --cpu-max-prime=20000 --num-threads=$threads run | tee -a $LOG_FILE | |
done | |
echo "Preparing OLTP test database" | tee -a $LOG_FILE | |
mysql -u root -e "drop database if exists sbtest" | |
mysql -u root -e "create database sbtest" | |
sysbench --test=oltp --db-driver=mysql --mysql-table-engine=innodb --oltp-table-size=500000 --mysql-user=root --mysql-socket=/opt/zends/data/zends.sock prepare | tee -a $LOG_FILE | |
for threads in $THREAD_RUNS | |
do | |
echo "=============== OLTP COMPLEX $threads ================" >> $LOG_FILE | |
sysbench --num-threads=$threads --db-driver=mysql --max-requests=100000 --test=oltp --oltp-table-size=500000 --mysql-socket=/opt/zends/data/zends.sock --oltp-test-mode=complex --mysql-user=root run | tee -a $LOG_FILE | |
done | |
mysql -u root -e "drop database if exists sbtest" | |
MUTT=`which mutt` | |
rc=$? | |
if [[ $rc != 0 ]]; then | |
echo "Could not find mutt. Please send $LOG_FILE to [email protected]" | |
else | |
HOSTNAME=`hostname` | |
mutt -a sysbench_driver.log -s "sysbench results for $HOSTNAME " $REPORT_EMAIL < /dev/null | |
echo "Attempted to send $LOG_FILE to $REPORT_EMAIL." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment