본문 바로가기
아이티 공부/리눅스

리눅스 stress 툴을 통해 CPU, Memory 스트레스 부하 주는 방법

by Klero 2019. 10. 21.
반응형
테스트 OS : AWS EC2 CentOS Linux release 7.6.1810 (Core)

리눅스에 stress 툴 설치


Stress 툴 설치하기 전에 EPEL 레포지터리를 활성화 합니다.
# yum -y install epel-release

Stress 툴을 설치합니다.
# yum -y install stress

Stress 툴 명령어 옵션


# stress --help
`stress' imposes certain types of compute stress on your system

Usage: stress [OPTION [ARG]] ...
-?, --help         show this help statement
     --version      show version statement
-v, --verbose      be verbose
-q, --quiet        be quiet
-n, --dry-run      show what would have been done
-t, --timeout N    timeout after N seconds
     --backoff N    wait factor of N microseconds before work starts
-c, --cpu N        spawn N workers spinning on sqrt()
-i, --io N         spawn N workers spinning on sync()
-m, --vm N         spawn N workers spinning on malloc()/free()
     --vm-bytes B   malloc B bytes per vm worker (default is 256MB)
     --vm-stride B  touch a byte every B bytes (default is 4096)
     --vm-hang N    sleep N secs before free (default none, 0 is inf)
     --vm-keep      redirty memory instead of freeing and reallocating
-d, --hdd N        spawn N workers spinning on write()/unlink()

     --hdd-bytes B  write B bytes per hdd worker (default is 1GB)


리눅스 stress 툴을 통해 CPU, Memory 스트레스 부하 주는 방법



Stress 툴 사용 방법 예제


CPU 부하 주는 방법

# stress -c <코어 수>
grep -c processor /proc/cpuinfo 명령어를 통해 CPU 코어 전체 개수를 확인할 수 있습니다.
stress 툴에 코어 수를 지정하면 해당 코어는 100%를 사용하게 됩니다.

Memory 부하 주는 방법

# stress --vm <프로세스 수> –vm-bytes <사용할 크기>
예 : stress --vm 3 --vm-bytes 1024m

HDD 부하 주는 방법

# stress --hdd <hdd 수> --hdd-bytes <사용할 크기>

예 : stress --hdd 3 --hdd-bytes 1024m


댓글