Linux壓力測試工具stress的參數詳解

爲了測試服務器的負載狀況,可使用stress這個壓力測試工具,能夠在環境上驗證測試下。服務器

stress安裝

sudo yum install -y epel-release sudo yum install -y stress

參數說明

[root@iZ2ze7aznw5uolxelrna1gZ ~]# 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 // 等待xx微秒後纔開始運行 --backoff N wait factor of N microseconds before work starts // 產生多個處理sqrt()函數的CPU進程 -c, --cpu N spawn N workers spinning on sqrt() // 產生多個處理sync()函數的磁盤I/O進程 -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) Example: stress --cpu 8 --io 4 --vm 2 --vm-bytes 128M --timeout 10s Note: Numbers may be suffixed with s,m,h,d,y (time) or B,K,M,G (size).

測試場景舉例

1.測試CPU負荷ide

$stress –c 4

增長4個cpu進程,處理sqrt()函數函數,以提升系統CPU負荷函數

2.內存測試工具

$stress –i 4 –vm 10 –vm-bytes 1G –vm-hang 100 –timeout 100s

新增4個io進程,10個內存分配進程,每次分配大小1G,分配後不釋放,測試100S測試

相關文章
相關標籤/搜索