AWS EC2 부하 생성을 위한 Stress모듈
$ sudo amazon-linux-extras install epel -y
Installing epel-release
...........
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
amzn2-core | 3.7 kB 00:00
amzn2extra-docker | 3.0 kB 00:00
amzn2extra-epel | 1.7 kB 00:00
(1/7): amzn2-core/2/x86_64/updateinfo | 245 kB 00:00
(2/7): amzn2-core/2/x86_64/group_gz | 2.5 kB 00:00
(3/7): amzn2extra-epel/2/x86_64/primary_db | 1.8 kB 00:00
(4/7): amzn2extra-docker/2/x86_64/updateinfo | 69 B 00:00
(5/7): amzn2extra-epel/2/x86_64/updateinfo | 69 B 00:00
(6/7): amzn2extra-docker/2/x86_64/primary_db | 68 kB 00:00
(7/7): amzn2-core/2/x86_64/primary_db | 43 MB 00:00
...........
$ sudo yum install stress -y
.........
$ stress --version
stress 1.0.4
$ stress -옵션 매개변수(parameter)
#예제
$ stress --cpu 8
$ stress --io 4
$ stress --vm 2
$ stress --vm-bytes 128M --timeout 10s
특정 함수를 실행시키면서 CPU, I/O, Memory, HDD에 부하를 줄 수 있다.
Stress 명령 실행 이후에 load가 증가하였음을 확인할 수 있다!
$ uptime
11:35:47 up 11 min, 1 user, load average: 0.00, 0.02, 0.00
$ sudo stress --cpu 8 --timeout 20
stress: info: [3643] dispatching hogs: 8 cpu, 0 io, 0 vm, 0 hdd
stress: info: [3643] successful run completed in 20s
$ uptime
11:40:00 up 15 min, 1 user, load average: 2.35, 0.78, 0.28
stress: info: [3666] dispatching hogs: 16 cpu, 0 io, 0 vm, 0 hdd
stress: dbug: [3666] using backoff sleep of 48000us
stress: dbug: [3666] setting timeout to 20s
stress: dbug: [3666] --> hogcpu worker 16 [3667] forked
......
setting timeout to 20s
stress: dbug: [3666] --> hogcpu worker 3 [3680] forked
stress: dbug: [3666] using backoff sleep of 6000us
stress: dbug: [3666] setting timeout to 20s
stress: dbug: [3666] --> hogcpu worker 2 [3681] forked
stress: dbug: [3666] using backoff sleep of 3000us
stress: dbug: [3666] setting timeout to 20s
stress: dbug: [3666] --> hogcpu worker 1 [3682] forked
stress: dbug: [3666] <-- worker 3669 signalled normally
stress: dbug: [3666] <-- worker 3674 signalled normally
stress: dbug: [3666] <-- worker 3679 signalled normally
.....
stress: dbug: [3666] <-- worker 3672 signalled normally
stress: dbug: [3666] <-- worker 3673 signalled normally
stress: dbug: [3666] <-- worker 3668 signalled normally
stress: info: [3666] successful run completed in 20s
$ uptime
11:43:23 up 18 min, 1 user, load average: 4.25, 1.41, 0.56
$ uptime
11:44:44 up 19 min, 1 user, load average: 1.12, 1.07, 0.51
$ uptime
11:45:16 up 20 min, 1 user, load average: 0.68, 0.97, 0.49
$ uptime
11:45:29 up 20 min, 1 user, load average: 0.53, 0.92, 0.48
<참고>