Need a bash/Linux guru to write a script to automate execution of some performance benchmarks. This script will iterate through and execute about a dozen different benchmark programs individually. The output of the benchmarks will be piped into a processing script or flat file. Some benchmarks need to be executed in the background with nohup and the script should be capable of polling those background benchmarks until completion.
## Deliverables
Here is exactly what the script need to do:
1. When it starts, prompt for 3 values: Hostname, Server ID, and Test ID
2. Hostname should be set in /etc/sysconfig/network and using `hostname`
3. Server ID and Test ID should be set in environment variables in /etc/profile (CH_SERVER_ID,? CH_TEST_ID) which should then be sourced to take immediate effect
4. Script should then check that at least 2.5xMemory free space is available on disk in the partition where /home resides. If 2.5xMemory is not available, exit and output "Insufficient free space available in /home partition"
4. Script should then execute `[login to view URL] -v` and look for a success message. If success message is not presented, exit and output "Benchmarking cannot proceed because database is not accessible"
Bonnie++ Benchmark
1. chmod go+w /dev/null
2. su - cloudharmony
3. (as cloudharmony user) /usr/sbin/bonnie++ -n 512 -m $CH_SERVER_ID -fq (capture output to /tmp/[login to view URL])
4. exit out of cloudharmony user (back to root) and execute: [login to view URL] /tmp/[login to view URL]
Geekbench Benchmark:
1. If 64-bit:? geekbench-64bit -s | [login to view URL]
2. If 32-bit:? geekbench -s | [login to view URL]
hdparm Benchmark:
1. Determine which device handles the primary / partition (i.e. /dev/hda1)
2.? hdparm -t /dev/[device from #1] | [login to view URL]; hdparm -T /dev/[device from #1] | [login to view URL]
mysql-bench Benchmark:
1.? service mysql start
2.? rm -rf? /var/lib/mysql/test
3. mkdir? rm -rf? /var/lib/mysql/test
4. chown mysql:mysql? /var/lib/mysql/test
5. cd /usr/share/sql-bench/
6. perl run-all-tests | [login to view URL]
tpcc-mysql Benchmark:
1.? cd /usr/local/tpcc-mysql
2.? rm -rf? /var/lib/mysql/tpcc
3. mkdir? rm -rf? /var/lib/mysql/tpcc
4. chown mysql:mysql /var/lib/mysql/tpcc
5. mysql tpcc < [login to view URL]
6. mysql tpcc < [login to view URL]
7. ./tpcc_load localhost tpcc root '' 10
8.? ./tpcc_start localhost tpcc root '' 10 6 60 180 | [login to view URL]
9. service mysql stop
10. rm -rf? /var/lib/mysql/test? /var/lib/mysql/tpcc
phpbench Benchmark:
1.? cd /var/lib/phpbench
2. php [login to view URL] | [login to view URL]
pybench Benchmark:
1.? cd /var/lib/pybench
2. python [login to view URL] | [login to view URL]
redis-benchmark Benchmark:
1.? cd /usr/local/redis
2. Launch server in background and capture PID: ./redis-server &
3.? ./redis-benchmark -n 100000 | [login to view URL]
4. When #3 completes, kill redis-server process from #2
ruby-benchmark-suite Benchmark:
1.? cd /var/lib/ruby-benchmark-suite
2. rake bench:dir DIR=benchmarks/macro-benchmarks | [login to view URL]
loopback-performance Benchmark:
1. Launch background process:? nc -d -l 9999 > /dev/null &
2.? time dd if=/dev/zero bs=1M count=10000 | nc localhost 9999
3. Capture output from #2 into /tmp/[login to view URL]
4.? [login to view URL] /tmp/[login to view URL]
SPECjvm2008 Benchmark:
1.? cd /var/lib/SPECjvm2008
2.? Launch in background:? nohup java -jar [login to view URL] --propfile props/[login to view URL] > /tmp/[login to view URL] &
3.? Upon completion (may take up to 12 hours):? [login to view URL] /tmp/[login to view URL]
Unixbench Benchmark:
1.? Launch in background: nohup? unixbench > /tmp/[login to view URL] &
2.? Upon completion (may take up to 12 hours):? [login to view URL] /tmp/[login to view URL]
phoronix-test-suite Benchmark:
1.? rm -rf /var/lib/pgsql/data
2. chmod go+w /dev/null
3.? service postgresql start
4. service postgresql stop
5. Launch in background: nohup [login to view URL] > /tmp/[login to view URL] &
6. Upon completion (may take up to 24 hours):? [login to view URL] /tmp/[login to view URL]
Cleanup:
1. Remove environment variables? (CH_SERVER_ID,? CH_TEST_ID) from /etc/profile
2.? cd /var/www/sierra/log/
3. rm -f *
4. cd /var/lib/SPECjvm2008/results/
5. rm -rf SPEC*
6. cd /tmp/
7. rm -rf *
8. cd ~/.phoronix-test-suite/test-results/
9. rm -rf $CH_TEST_ID*
10. cd /var/www/sierra/tmp/
11. rm -f $CH_TEST_ID*
12. Output: Benchmarks completed successfully
Other Requirements:
Script should write to /tmp/benchmark-status to track what step it is currently on in the benchmark process and the time that step was started (i.e. 4/25/2010 18:25:35,phoronix-test-suite
Output of the entire benchmark process should also be written to /tmp/benchmark-output
Upon completion of all benchmarks, write "completion" to? /tmp/benchmark-status
Script should also output the current benchmark status to stdout
If script gets terminated while? SPECjvm2008,? Unixbench or? phoronix-test-suite benchmarks are executing in the background, and the script is re-started, and those benchmarks are still executing in the background, it should resume where it left off (probably need to keep track of the PID for those background processes and use that in conjunction with? /tmp/benchmark-status to determine whether to resume or start over when the script is started)
Note:
A development environment will be provided in EC2