二種類の分析
パフォーマンスエンジニアリングには
・アプリケーションの挙動を見る「ワークロード分析」
・デバイスの挙動を見る「リソース分析」
の二種類がある、とのこと。
Linuxの調査
# uptime 03:32:29 up 433 days, 2:29, 2 users, load average: 0.05, 0.07, 0.08
dmesg -T
[土 1月 28 07:44:10 2023] TCP: request_sock_TCP: Possible SYN flooding on port 22. Sending cookies. Check SNMP counters.
vmstat -SM 1
# vmstat -SM 1 1 procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- r b swpd free buff cache si so bi bo in cs us sy id wa st 0 1 0 460 29 296 0 0 43 71 0 0 1 0 97 2 0
mpstat -P ALL 1
# mpstat -P ALL 1 1 2023年04月21日 _x86_64_ (2 CPU) 03時34分23秒 CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle 03時34分24秒 all 0.50 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 99.50 03時34分24秒 0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00 03時34分24秒 1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00 平均値: CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle 平均値: all 0.50 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 99.50 平均値: 0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00 平均値: 1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00
pidstat 1
# pidstat 1 1 2023年04月21日 _x86_64_ (2 CPU) 03時35分06秒 UID PID %usr %system %guest %CPU CPU Command 03時35分07秒 112 17921 1.00 0.00 0.00 1.00 0 mongod 03時35分07秒 0 23520 1.00 0.00 0.00 1.00 1 kworker/1:2 平均値: UID PID %usr %system %guest %CPU CPU Command 平均値: 112 17921 1.00 0.00 0.00 1.00 - mongod 平均値: 0 23520 1.00 0.00 0.00 1.00 - kworker/1:2
iostat -sxz 1
# iostat -xz 1 1 2023年04月21日 _x86_64_ (2 CPU) avg-cpu: %user %nice %system %iowait %steal %idle 0.81 0.00 0.48 2.14 0.02 96.55 Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await r_await w_await svctm %util sda 0.00 27.07 3.66 6.95 86.53 141.77 43.04 0.10 9.83 16.58 6.27 4.06 4.30
free -m
# free -m total used free shared buff/cache available Mem: 996 208 446 23 341 614 Swap: 0 0 0
sar -n DEV 1
sar -n TCP,ETCP 1
top
使いえそうなコマンドも多かったので覚えておきます。