오토스케일링(예를들어 cpu 80% 이상일 때 늘림)을 테스트할 때 stress 패키지로 cpu 사용량을 강제로 늘릴 수 있다.
일단 현재 사용중인 aws ec2 또는 gcp vm instance가 몇개의 cpu를 갖고 있는지 확인해보자.
grep -c processor /proc/cpuinfo
stress 패키지 설치하기
yum repository에 기본적으로 stress 패키지가 없기 때문에 stress 패키지를 설치하기 전에 EPEL repository를 활성화 시켜야 한다.
EPEL(Extra Packages for Enterprise Linux) repository는 yum의 확장된 최신 저장소이다.
amazon-linux-extras install epel # epel 설치 (aws linux(centos)인 경우)
또는
yum -y install epel # epel 설치
yum -y install stress
stress --cpu 1 --timeout 10s # 1개의 cpu를 10초동안 cpu 사용률을 100%로 강제 올림