리눅스서버 Stress 과부하 테스트 방법

리눅스(Centos) 환경에서는 host 부하 테스트용으로 stress 툴을 통해 가상으로 Stress를 발생시켜 성능 측정을 유용하게 할 수 있다.

1. Stress Tool 설치

EPEL 레포지터리를 활성화

$ yum -y install epel-release

Stress Tool 설치

$ yum -y install 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)

2. 사용 예시

1G 크기의 파일을 디스크에 쓰고 지우는 작업을 5분간 연속으로 수행

$ stress --hdd 1 --hdd-bytes 1G -v --timeout 5m

3G 크기의 파일을 디스크에 쓰고 보관하는 작업을 5분간 연속으로 수행

$ stress --hdd 1 --hdd-bytes 3G -v --timeout 5m

8개의 프로세스로 CPU 부하 테스트, 4개의 프로세스로 I/O 영역 테스트, 2개의 프로세스로 메모리 테스트(128M씩 할당후 해제)를 10초간 수행

$ stress --cpu 8 --io 4 --vm 2 --vm-bytes 128M --timeout 10s -v

좋은 웹페이지 즐겨찾기