In this article, we will explore the procedure involved with installing and using Tmux on any Linux or Debian-based distribution, empowering you to harness the
Learn how to install and use Sysbench on RHEL 9 and CentOS 9 to benchmark CPU, memory, disk, and database performance. Step-by-step instructions, CLI examples, and optimization tips included.
Sysbench is a versatile, modular, and open-source benchmarking tool widely used to evaluate system performance in various environments. It can test CPU, memory, I/O, file I/O, and database performance, making it indispensable for systems administrators and database engineers. In this post, we’ll walk through how to install Sysbench on RHEL 9 and CentOS 9, and explore some CLI examples to help you get started with benchmarking on your setup.
To begin, ensure that you have:
Prerequisite | Description |
---|---|
OS Version | RHEL 9 or CentOS 9 |
User Access | Root or sudo privileges |
Network | Active internet connection |
Let’s dive in!
To install Sysbench on RHEL 9 or CentOS 9, we’ll need the EPEL (Extra Packages for Enterprise Linux) repository, as Sysbench isn’t available in the default repository for these distributions.
Add the EPEL Repository |
sudo dnf install -y epel-release
This command installs the EPEL repository, which provides additional packages for RHEL-based distributions, including Sysbench.
Install Sysbench |
sudo dnf install -y sysbench
Photo by admingeek from Infotechys
Once completed, verify the installation by checking the Sysbench version:
sysbench --version
You should see output similar to:
sysbench 1.0.20
Sysbench allows you to perform several types of benchmarks, such as CPU, memory, and I/O tests. Here’s a look at some of the most common benchmarking commands you can use.
CPU Benchmarking |
Test your CPU performance by running:
sysbench cpu --cpu-max-prime=20000 run
The --cpu-max-prime
parameter defines the upper limit for calculating prime numbers, with higher values providing more stress on the CPU.
sysbench 1.0.20 (using system LuaJIT 2.1.0-beta3)
Running the test with following options:
Number of threads: 1
Initializing random number generator from current time
Prime numbers limit: 20000
Initializing worker threads...
Threads started!
CPU speed:
events per second: 333.66
General statistics:
total time: 10.0023s
total number of events: 3338
Latency (ms):
min: 2.86
avg: 3.00
max: 5.70
95th percentile: 3.30
sum: 9998.99
Threads fairness:
events (avg/stddev): 3338.0000/0.00
execution time (avg/stddev): 9.9990/0.00
This output provides an idea of how well your CPU can handle high workloads.
Memory Benchmarking |
Memory performance testing involves writing to and reading from memory. Run the following command to test memory read and write speed:
sysbench memory --memory-block-size=1M --memory-total-size=4G run
--memory-block-size
: Sets the block size for each read/write operation.--memory-total-size
: Total data size to transfer.Metric | Value |
---|---|
Transfer Rate | 4096.00 MiB transferred (9906.76 MiB/sec) |
General Statistics | total time: 0.4112s total number of events: 4096 |
Threads fairness | events (avg/stddev): 4096.0000/0.00 execution time (avg/stddev): 0.4084/0.00 |
Disk I/O Benchmarking |
Disk performance benchmarking in Sysbench can help assess read and write speeds on your storage. First, you’ll need to create a test file:
sysbench fileio --file-total-size=5G prepare
sysbench 1.0.20 (using system LuaJIT 2.1.0-beta3)
128 files, 40960Kb each, 5120Mb total
Creating files for the test...
Extra file open flags: (none)
Creating file test_file.0
Creating file test_file.1
Creating file test_file.2
Creating file test_file.3
Creating file test_file.4
Creating file test_file.5
Creating file test_file.6
Creating file test_file.7
Creating file test_file.8
Creating file test_file.9
Creating file test_file.10
Creating file test_file.11
Creating file test_file.12
Creating file test_file.13
Creating file test_file.14
...omitted for brevity...
Creating file test_file.127
5368709120 bytes written in 53.33 seconds (96.01 MiB/sec).
After creating the files, run the following command to benchmark disk I/O performance:
sysbench fileio --file-total-size=5G --file-test-mode=rndrw run
Photo by admingeek from Infotechys
--file-total-size
: Sets the size of the test file.--file-test-mode
: Configures Sysbench to perform random read/write operations (rndrw
).Database Benchmarking |
Sysbench supports benchmarking for MySQL and PostgreSQL databases. Ensure you have the appropriate database software installed and a test database created. Here’s a simple example with MySQL:
Prepare the database |
sysbench oltp_read_write --db-driver=mysql --mysql-user=root --mysql-password=yourpassword --tables=10 --table-size=10000 prepare
Run the Database Benchmark |
sysbench oltp_read_write --db-driver=mysql --mysql-user=root --mysql-password=yourpassword --tables=10 --table-size=10000 run
Test | Value |
---|---|
Transactions/sec | 500 |
Reads/sec | 2500 |
Writes/sec | 1500 |
Latency (avg) | 4.1 ms |
To make things easier, here’s a table summarizing essential Sysbench commands for quick reference:
Benchmark Type | Command Example |
---|---|
CPU | sysbench cpu --cpu-max-prime=20000 run |
Memory | sysbench memory --memory-block-size=1M --memory-total-size=10G run |
Disk I/O | sysbench fileio --file-total-size=5G --file-test-mode=rndrw run |
Database | sysbench oltp_read_write --db-driver=mysql --mysql-user=root --mysql-password=yourpassword run |
Once you’ve gathered benchmark data, consider these steps to optimize performance:
CPU Optimization: If CPU performance is lower than expected, consider upgrading your processor or increasing CPU resources in virtualized environments.
Memory Tuning: Increase the available memory if your workload requires high memory throughput. Adjusting the swap size can also help in memory-bound applications.
Disk I/O: Upgrade to SSDs or NVMe storage if disk read/write speeds are low, or explore using RAID for improved redundancy and performance.
Database Optimization: Tune database settings such as cache size, query optimization, and indexing. For MySQL, for example, adjusting innodb_buffer_pool_size
can lead to improved performance.
Sysbench offers robust and flexible benchmarking capabilities, making it an essential tool for administrators and engineers looking to optimize their systems on RHEL 9 or CentOS 9. With CPU, memory, disk, and database benchmarking available, Sysbench can reveal vital insights into where your system may need adjustments. By following this guide, you should be well on your way to accurately assessing and enhancing the performance of your infrastructure.
Ensure to run these benchmarks periodically to monitor the impact of any changes or upgrades, and stay ahead in keeping your system optimized.
Did you find this article useful? Your feedback is invaluable to us! Please feel free to share your thoughts in the comments section below and share this post!
In this article, we will explore the procedure involved with installing and using Tmux on any Linux or Debian-based distribution, empowering you to harness the
This guide aims to equip you with the knowledge needed to install ELK stack on RHEL9 | CentOS9 effortlessly. By following these steps, you can
In this comprehensive guide, we’ll walk through the process of deploying a MySQL database using Podman, covering installation, configuration, and best practices. Table of Contents