15.12.2023

Tool for Stress-Test Server's CPU

What is stress-tool?

Stress testing tools are a vital part of any software development or system optimization process, as they allow developers to identify potential issues with their systems before deployment. It should be noted that it has nothing directly related to user experience — the sole purpose is ensuring a smooth and glitch-free operation for all involved parties including clients/users! Here are some reasons why such instruments are beneficial:

In that instruction we will consider one of the example such tool for testing CPU!

Practice usage

Commonly for estimate how our system will work in the production, we need to make plan. Split our system for several parts: software, hardware and network. All of them needed to be benchmark with average value of performance. In that part of instruction we will consider estimation of server's CPU on the Linux machine. Which occupied large part of product server in the world. Also for the system process influence disks speed, RAM and etc.

Firts of move in any manipulation it's updating package in the system by one command below:

apt update && apt upgrade -y

Screenshot №1 — Update package

We will use sysbench for make intense and express test our server without installation complex software, that can be useful for situation when we need estimate server in determine deadline. And answer how that will work? Install process isn't complexity:

apt install sysbench

Screenshot №2 — APT

Wait till process will be done and now we can use utility for test. Stop anything useless services or daemon which you will not use in the system. Syntax of command looks like  sysbench [options] [testname] command that multitool can check also RAM, I/O system and etc. but we look at the CPU section. For test you need use command:

sysbench cpu --cpu-max-prime=30000 run

Screenshot №3 — Example of usage

In the picture you can see different metrics: speed, latency and threads fairness. We make test by solving 30 000 prime numbers, but you can choose any else suitable test. By the default utility use one of the threads, modern program application use at least 2 or more threads, therefore we need options that model load of software with traffic. For that we can use:

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

Screenshot №4 — Example of usage with threads

That test we make on the machine with 1 core process with possibility to process 4 threads, but what if we increase our power? Let's make equal test on the machine with 4 core CPU and possibility to process 16 threads. For clearness of experiment we run the same test:

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

Screenshot №5 — More power

Average value rapidly down to the 6X! Also that utility can use for comparison or just for estimate power of server component!

 

In this instructional guide, we explored an example of a stress testing tool for testing the CPU, focusing on sysbench for Linux machines. The guide covered the process of updating packages, installing sysbench, and conducting CPU stress tests. The practical examples demonstrated how to evaluate server CPU performance, highlighting the impact of varying factors such as the number of threads and CPU cores. The guide concluded by emphasizing the utility of stress testing tools for comparing server components and estimating system power.