How to test performance of VPS, Cloud or dedicated server?
When it comes to choose the right VPS or dedicated server for your solution, you may want to test its performance.
Some time ago, I stood before such choice. To optimize the testing process, I wrote a bash script for Ubuntu distributions based on SysBench.
- You can also use it to test performance of any PC machine.
- You will need root access.
- Script will perform CPU, I/O and MySQL performance test, ten times each, so it should be 30 log files to take medium values and comapre with other machines results
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
#!/bin/bash # Package sources update apt-get update sleep 5s # mysql install and set root password to 123PAssword debconf-set-selections <<< 'mysql-server mysql-server/root_password password 123PAssword' sleep 1s debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password 123PAssword' sleep 1s apt-get -y install mysql-server sleep 5s # Installation of Sysench - benchmarking tool apt-get install sysbench sleep 1s # create directory for logs mkdir /root/sysbench_log/ # Create directory for CPU logs mkdir /root/sysbench_log/cpu/ echo "Starting CPU test" # 10x CPU test for up to 20 threads for i in `seq 1 10`; do echo "test cpu $i" sysbench --test=cpu --cpu-max-prime=20000 --num-threads=2 run > /root/sysbench_log/cpu/$i.log done echo "CPU test finished" # Create directory for I/O logs mkdir /root/sysbench_log/io/ # Create 500MB sample file fot I/O test sysbench --test=fileio --file-total-size=500M prepare echo "Starting IO test" # 10x I/O test for i in `seq 1 10`; do echo "IO test $i" sysbench --test=fileio --file-total-size=500M --file-test-mode=rndrw --init-rng=on --max-time=300 --max-requests=0 run > /root/sysbench_log/io/$i.log done echo "IO test finished" # Remove sample file sysbench --test=fileio --file-total-size=500M cleanup echo "Starting MySQL test" # Create database mysql -uroot -p123PAssword -e 'CREATE DATABASE test;' # Create directory for MySQL test logs mkdir /root/sysbench_log/mysql/ # Creation of sample record in test database sysbench --test=oltp --oltp-table-size=1000000 --mysql-db=test --mysql-user=root --mysql-password=123PAssword prepare # 10x MySQL test for i in `seq 1 10`; do echo "MySQL test $i" sysbench --test=oltp --oltp-table-size=1000000 --mysql-db=test --mysql-user=root --mysql-password=123PAssword --max-time=60 --oltp-read-only=on --max-requests=0 --num-threads=8 run > /root/sysbench_log/mysql/$i.log done echo "MySQL test finished" # Remove sample records form test database sysbench --test=oltp --mysql-db=test --mysql-user=root --mysql-password=123PAssword cleanup echo "All test finished. Check results at /root/sysbench_log/" |
Related links:
- SysBench on GitHub
- HowtoForge – How To Benchmark Your System (CPU, File IO, MySQL) With sysbench
- Mike Jung Wiki – Sysbench