본문 바로가기

Linux Distributions

How to install and use stress

728x90
반응형

How to install and use stress

Stress is a command-line tool that can be used to stress test a system by generating a workload on the CPU, memory, and I/O. It is a useful tool for testing the performance of a system under load, and can also be used to troubleshoot performance problems.

 

To install stress, you can use the following command:

sudo apt install stress

Once stress is installed, you can use it by running the following command:

stress [options]

The options available for stress vary, but some of the most common options include:

 

  • -c number : The number of CPU workers to spawn.
  • -m number : The amount of memory to allocate to each CPU worker.
  • -i number : The number of I/O workers to spawn.
  • -t number : The number of seconds to run the stress test.

 

For example, the following command would spawn 10 CPU workers, allocate 1GB of memory to each CPU worker, spawn 10 I/O workers, and run the stress test for 30 seconds:

stress -c 10 -m 1024 -i 10 -t 30

To see a list of all the available options, you can run the following command:

stress --help

For more information on using stress, you can refer to the stress manual page: https://linux.die.net/man/1/stress.

 

Here are some examples of how to use stress:

  • To stress test the CPU, you would use the -c option. For example, the following command would spawn 10 CPU workers and run the stress test for 30 seconds:
stress -c 10 -t 30
  • To stress test the memory, you would use the -m option. For example, the following command would allocate 1GB of memory to each of 10 CPU workers and run the stress test for 30 seconds:
stress -m 1024 -c 10 -t 30
  • To stress test the I/O, you would use the -i option. For example, the following command would spawn 10 I/O workers and run the stress test for 30 seconds:
stress -i 10 -t 30
  • To stress test all three resources, you would use all three options. For example, the following command would spawn 10 CPU workers, allocate 1GB of memory to each CPU worker, spawn 10 I/O workers, and run the stress test for 30 seconds:
stress -c 10 -m 1024 -i 10 -t 30

 

I hope this helps! Let me know if you have any other questions.

 

728x90
반응형