前面有使用過 Stressful Application Test (Stressapptest) https://benjr.tw/96740 這邊針對他的 記憶體 測試詳細來做說明.
測試環境為 Ubuntu16.04 64bits
Memory
與記憶體相關的參數
- -s seconds : Number of seconds to run
- -M mbytes : Megabytes of ram to test
- -m threads : Number of memory copy threads to run.
- -C (c) threads : Number of memory CPU stress threads to run.-c (小寫) 會做 Data Check
- -i threads : Number of memory invert threads to run.
主要測試記憶體的參數是 -m (auto-detect to number of CPUs),就算不設定,預設系統會幫我們自動偵測 CPU 數,然後搭配一樣個數的 threads 來進行測試.此時透過 top 來觀看 CPU 的使用率幾乎都達 100%.
如果你還想再加入更多的 thread 來進行測試,可以使用 -C 繼續增加 thread ,或是 -i 加入 invert thread (一般的 thread 會將資料從一個區塊複製到另一個區塊,而 invert thread 會原地反轉資料.)
一般不指定 thread 透過 stressapptest 來自動偵測 (CPU 數然後搭配一樣個數的 thread).
root@ubuntu:~# stressapptest -s 60 -M 4000 Log: Commandline - stressapptest -s 60 -M 4000 Stats: SAT revision 1.0.6_autoconf, 64 bit binary Log: buildd @ kapok on Wed Jan 21 17:09:35 UTC 2015 from open source release Log: 1 nodes, 16 cpus. Log: Defaulting to 16 copy threads Log: Prefer plain malloc memory allocation. Log: Using memaligned allocation at 0x7fb3d4412000. Stats: Starting SAT, 4000M, 60 seconds Log: Region mask: 0x1 Log: Seconds remaining: 50 Log: Seconds remaining: 40 Log: Seconds remaining: 30 Log: Seconds remaining: 20 Log: Seconds remaining: 10 Stats: Found 0 hardware incidents Stats: Completed: 812878.00M in 60.05s 13537.25MB/s, with 0 hardware incidents, 0 errors Stats: Memory Copy: 812878.00M at 13544.86MB/s Stats: File Copy: 0.00M at 0.00MB/s Stats: Net Copy: 0.00M at 0.00MB/s Stats: Data Check: 0.00M at 0.00MB/s Stats: Invert Data: 0.00M at 0.00MB/s Stats: Disk: 0.00M at 0.00MB/s Status: PASS - please verify no corrected errors
可以透過 #pstress 觀看 threads 數量 (總 threads : 18, CPU core 16 + 2 threads?)
root@ubuntu:~# pstree |grep -i stress -gnome-terminal--+-bash---sudo---su---bash---stressapptest---18*[{stressapptest}]
透過 -c (小寫, 會做 Data Check) 繼續增加 threads 數量.
root@ubuntu:~# stressapptest -s 60 -M 4000 -c 8 Log: Commandline - stressapptest -s 60 -M 4000 -c 8 Stats: SAT revision 1.0.6_autoconf, 64 bit binary Log: buildd @ kapok on Wed Jan 21 17:09:35 UTC 2015 from open source release Log: 1 nodes, 16 cpus. Log: Defaulting to 16 copy threads Log: Prefer plain malloc memory allocation. Log: Using memaligned allocation at 0x7f779000a000. Stats: Starting SAT, 4000M, 60 seconds Log: Region mask: 0x1 Log: Seconds remaining: 50 Log: Seconds remaining: 40 Log: Seconds remaining: 30 Log: Seconds remaining: 20 Log: Seconds remaining: 10 Stats: Found 0 hardware incidents Stats: Completed: 897459.00M in 60.13s 14925.17MB/s, with 0 hardware incidents, 0 errors Stats: Memory Copy: 693924.00M at 11563.15MB/s Stats: File Copy: 0.00M at 0.00MB/s Stats: Net Copy: 0.00M at 0.00MB/s Stats: Data Check: 203535.00M at 3385.54MB/s Stats: Invert Data: 0.00M at 0.00MB/s Stats: Disk: 0.00M at 0.00MB/s Status: PASS - please verify no corrected errors
(總 threads : 26), CPU core 16 + 8 + 2 threads?
root@ubuntu:~# pstree |grep -i stress -gnome-terminal--+-bash---sudo---su---bash---stressapptest---26*[{stressapptest}]
加入 8個 invert threads 數量.
root@ubuntu:~# stressapptest -s 60 -M 4000 -i 8 Log: Commandline - stressapptest -s 60 -M 4000 -i 8 Stats: SAT revision 1.0.6_autoconf, 64 bit binary Log: buildd @ kapok on Wed Jan 21 17:09:35 UTC 2015 from open source release Log: 1 nodes, 16 cpus. Log: Defaulting to 16 copy threads Log: Prefer plain malloc memory allocation. Log: Using memaligned allocation at 0x7fda35d62000. Stats: Starting SAT, 4000M, 60 seconds Log: Region mask: 0x1 Log: Seconds remaining: 50 Log: Seconds remaining: 40 Log: Seconds remaining: 30 Log: Seconds remaining: 20 Log: Seconds remaining: 10 Stats: Found 0 hardware incidents Stats: Completed: 975798.00M in 60.03s 16255.22MB/s, with 0 hardware incidents, 0 errors Stats: Memory Copy: 681182.00M at 11349.21MB/s Stats: File Copy: 0.00M at 0.00MB/s Stats: Net Copy: 0.00M at 0.00MB/s Stats: Data Check: 0.00M at 0.00MB/s Stats: Invert Data: 294616.00M at 4909.51MB/s Stats: Disk: 0.00M at 0.00MB/s Status: PASS - please verify no corrected errors
(總 threads : 26), CPU core 16 + 8 + 2 threads?
root@ubuntu:~# pstree |grep -i stress -gnome-terminal--+-bash---sudo---su---bash---stressapptest---26*[{stressapptest}]
沒有解決問題,試試搜尋本站其他內容
One thought on “Linux command – Stressful Application Test (Memory)”