The cart is empty

Sysbench stands out as a popular tool for benchmarking and testing server performance. It enables measuring crucial performance aspects such as CPU, memory, I/O operations, and database server performance. In this article, we'll delve into specific steps and recommendations for setting up and configuring Sysbench for effective server performance measurement.

Installing Sysbench

Before running any tests, it's necessary to install Sysbench. On most Linux distributions, Sysbench can be installed using a package manager. For instance, on Debian or Ubuntu, use the command:

sudo apt-get update && sudo apt-get install sysbench

Configuring Tests

Sysbench offers a variety of tests you can run, including tests for CPU, memory, disk, and MySQL performance. Configuring a test depends on the specific needs of your measurement.

CPU Performance Test

The CPU performance test measures how quickly a server can perform computations. The test is configured with several parameters, including the number of threads and total test time. Here's an example command to run the CPU test:

sysbench cpu --cpu-max-prime=20000 --threads=4 run

This command sets Sysbench to test CPU with a maximum prime number computation of 20,000 and using 4 threads.

Memory Performance Test

The memory test evaluates the speed of reading from and writing to system memory. Here's an example command to run the memory test:

sysbench memory --memory-total-size=1G run

This command executes a memory test with a total tested size of 1 GB.

I/O Performance Test

I/O tests focus on the performance of the disk subsystem. You can test sequential or random reads and writes. To run an I/O test:

sysbench fileio --file-total-size=5G prepare
sysbench fileio --file-total-size=5G --file-test-mode=rndrw --threads=4 run
sysbench fileio --file-total-size=5G cleanup

This set of commands first prepares test files totaling 5 GB, then runs a random read/write test using 4 threads, and finally cleans up the test files.

Database Server Performance

For testing database server performance, you need to have MySQL or MariaDB server installed and running. Sysbench allows testing various database operations, including SELECT, INSERT, UPDATE, and DELETE. Here's an example of running a database performance test:

sysbench /usr/share/sysbench/oltp_read_write.lua --db-driver=mysql --mysql-db=testdb --mysql-user=testuser --mysql-password=testpass --tables=10 --table-size=1000 prepare
sysbench /usr/share/sysbench/oltp_read_write.lua --db-driver=mysql --mysql-db=testdb --mysql-user=testuser --mysql-password=testpass --tables=10 --table-size=1000 --threads=4 run
sysbench /usr/share/sysbench/oltp_read_write.lua --db-driver=mysql --mysql-db=testdb --mysql-user=testuser --mysql-password=testpass --tables=10 --table-size=1000 cleanup

These commands prepare the database for testing, run the test with 4 threads, and then clean up afterward.

 

Sysbench is a powerful tool for testing and measuring server performance. The precise configuration of tests depends on your specific needs and measurement goals. It's crucial to carefully consider which performance aspects you want to test and tailor the Sysbench settings to best suit your requirements.