Linux server load verification

Memo for load verification

Put a load on the CPU

#When using yes
#If one process is not enough, execute multiple
yes > /dev/null &

#When using gzip
#If one process is not enough, execute multiple
gzip -9 < /dev/urandom > /dev/null &

#When using openssl
openssl speed -multi `grep processor /proc/cpuinfo|wc -l`

Commentary Meaning of &: background execution <Bash_command >> / dev / null means: Discard the output. Nothing is displayed. <bash_command> </ dev / urandom means: generate a turbulence and pass it as an argument to the command

Memory load

The memory used will be increased by continuing to render the execution result of the yes command to / dev / null for the following execution.

#If one process is not enough, execute multiple
/dev/null < $(yes) & 

# malloc,A command that repeatedly executes the free function
# --Specify the number of processes to start with vm.
# --vm-Specify the memory to be allocated in bytes.
# --vm-If you specify keep, it will keep it reserved without doing free.
stress --vm 2 --vm-bytes 1G --vm-keep

Notes: If the value of --vm-bytes is too large, an error will occur because it will not fit in memory. At that time, --vm number of processes x --vm-bytes number is the total memory size, so the total memory can be increased by increasing the number of processes.

Capacity load

You can generate a file with the following command. Generate a file that is entirely filled with null characters.

Notes If you specify a bs that is too large to fit in the memory, it will fail. In this case, reduce the value of bs and increase the value of count. The value of bs * count is the final output file size.

#Generate a 100-byte file
dd bs=100 count=1 if=/dev/zero of=file1 
#Generate a 102400 byte file
dd bs=1K count=100 if=/dev/zero of=file2 
#Generate a 100000 byte file
dd bs=1KB count=100 if=/dev/zero of=file3 

If the log file is the bottleneck, delete or move it to secure free space.

#Last updated more than 90 days"*.log"Delete file
find $TARGET_DIR -type f -name "*.log" -mtime +90 | xargs rm -f

At the end, delete the started process

jobs

#Remove the argument for the process that appears in the job execution result
kill %1 %2 %3 ... %N

Recommended Posts

Linux server load verification
Linux server command
Linux Web server construction (Ubuntu & Apache)
Run a Linux server on GCP
Linux
Linux server construction link summary (CentOS7)
Linux file server construction (Ubuntu & Samba)
Verification of how to periodically execute a script on a Linux server on Windows
How to build my own Linux server
Build an NFS server on Arch Linux
Build a simple WebDAV server on Linux
Install and Configure TigerVNC server on Linux
Build a Samba server on Arch Linux
Dockerfile: Install Docker on your Linux server