Solaris: 性能測定コマンド
一般的な Java + Oracle の Solaris 10 サーバ環境で性能を測定するコマンドの例。負荷テストや性能監視などに。
いずれも10秒ごとにデータを採取している。
・スレッド(プロセッサ)単位のCPU使用率 – mpstat
1: $ mpstat -q 10 2: CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl 3: 0 129 0 27 366 114 402 9 23 14 0 949 2 6 0 92 4: 1 137 0 26 115 26 387 8 24 11 0 956 2 3 0 94 5: CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl 6: 0 0 0 0 348 121 77 0 2 0 0 88 0 1 0 99 7: 1 1 0 0 58 16 54 0 2 0 0 45 0 0 0 100 8: CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl 9: 0 0 0 4 407 127 157 2 14 4 0 216 0 3 0 96 10: 1 76 0 12 125 43 147 3 12 5 0 1237 0 4 0 95 11: CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl 12: 0 0 0 379 604 116 332 3 29 7 0 1273 0 12 0 88 13: 1 0 0 163 615 144 344 9 27 10 0 3014 1 15 0 83 14: CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl 15: 0 0 0 1093 1350 117 323 12 19 24 0 16569 4 34 0 62 16: 1 0 0 943 1296 110 297 12 19 38 0 9196 2 24 0 74 17: CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl 18: 0 36 0 629 710 122 980 8 23 53 0 7377 2 22 0 76 19: 1 21 0 253 838 103 1065 15 22 52 0 14078 4 31 0 65 20: CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl 21: 0 0 0 127 492 123 313 2 8 3 0 1481 1 9 0 90 22: 1 0 0 57 319 106 239 5 8 5 0 3047 2 16 0 83 23: CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl 24: 0 2 0 0 408 120 192 1 4 0 0 1366 1 8 0 92 25: 1 0 0 0 160 84 190 1 5 1 0 1589 1 8 0 92 26: CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl 27: 0 54 0 0 369 126 113 0 3 2 0 353 0 2 0 98 28: 1 0 0 0 87 21 93 0 3 2 0 37 0 1 0 99 29: CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl 30: 0 0 0 0 342 120 81 0 1 0 0 90 0 1 0 99 31: 1 3 0 0 84 28 84 0 2 1 0 47 0 1 0 99 32: CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl 33: 0 0 0 0 362 139 82 1 2 0 0 103 1 2 0 97 34: 1 0 0 0 76 24 71 1 2 0 0 72 0 1 0 98 35: CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl 36: 0 54 0 0 336 115 71 1 3 1 0 342 0 3 0 97 37: 1 0 0 0 91 27 87 0 3 1 0 59 0 1 0 98 38: ^C$usr user) ユーザアプリケーションのCPU使用率
sys system) カーネルプロセス・システムコールのCPU使用率
wt wait I/O) I/O待ちを示す項目だが、Solaris 10 では常に0
idl idle) 100(%) から usr + sys を引いた値 (ただし、丸め誤差のため総和が100にならない場合もある)
・CPUキュー数/メモリ使用率 – vmstat
1: $ vmstat -q 10 2: kthr memory page disk faults cpu 3: r b w swap free re mf pi po fr de sr f0 s0 s1 -- in sy cs us sy id 4: 0 0 0 494940 16372 8 26 0 0 0 0 16 -0 0 -1 0 359 295 144 0 2 98 5: 0 0 0 493008 18988 1 3 0 0 0 0 0 0 0 0 0 363 141 121 0 1 99 6: 0 0 0 493008 19000 19 55 0 0 0 0 0 0 0 0 0 364 397 131 1 1 98 7: 0 0 0 493008 19000 1 1 0 0 0 0 0 0 2 0 0 364 136 129 0 1 99 8: 0 0 0 492796 18824 4 20 0 0 0 0 0 0 9 0 0 343 3266 163 1 20 79 9: 0 0 0 488596 14664 17 50 0 0 0 0 0 0 41 0 0 294 17012 207 4 82 13 10: 0 0 0 489472 15500 2 6 0 0 0 0 0 0 74 0 0 326 17099 301 4 73 22 11: 0 0 0 487320 13360 0 1 0 0 0 0 0 0 99 0 0 405 11107 1047 4 50 46 12: 0 0 0 487200 13260 0 3 0 0 0 0 0 0 66 0 0 356 5300 428 3 42 55 13: 3 0 0 488736 14824 18 54 0 0 0 0 0 0 91 0 0 379 3201 403 2 34 64 14: 1 0 0 488860 14912 0 3 0 0 0 0 0 0 101 0 0 411 3763 407 1 27 72 15: 0 0 0 487524 13588 1 1 0 0 0 0 0 0 97 0 0 438 4056 450 1 20 78 16: 0 0 0 487940 13996 18 55 0 0 0 0 0 0 92 0 0 430 3790 393 1 20 79 17: 0 0 0 487564 13624 1 1 0 0 0 0 0 0 95 0 0 457 5576 512 2 18 80 18: 0 0 0 486716 12752 3 19 0 0 0 0 0 0 65 0 0 457 3492 19088 2 32 66 19: 21 0 0 473188 5932 1 5 0 68 1077 0 6488 0 17 0 0 209 309 8714 0 97 2 20: 12 0 0 470700 13140 19 58 0 52 52 0 0 0 40 0 0 238 1843 853 2 83 15 21: 10 0 0 465000 11884 1 2 0 212 931 0 1709 0 99 0 0 432 3292 7224 2 66 32 22: kthr memory page disk faults cpu 23: r b w swap free re mf pi po fr de sr f0 s0 s1 -- in sy cs us sy id 24: 0 0 0 461532 13188 17 55 0 0 0 0 0 0 19 0 0 398 3856 165 2 13 86 25: 0 0 0 461416 13140 1 2 0 0 0 0 0 0 4 0 0 374 2590 132 1 7 92 26: ^C$kthr:r Kernel THReads in Run queue) CPUキュー数
memory:free メモリ空き容量(KB)
※ディスク稼働率の概要、CPU全体の使用率も取得可能
※メモリ全体量はprtconf コマンドで取得可能
1: $ /usr/sbin/prtconf |grep Memory 2: Memory size: 540 Megabytes 3: $・スライス単位のディスク稼働率 – iostat -x
1: $ iostat -xnmpC 10 2: extended device statistics 3: r/s w/s kr/s kw/s wait actv wsvc_t asvc_t %w %b device 4: 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 c0 5: 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 c0t0d0 6: 2.3 1.3 180.0 13.2 0.0 0.1 0.0 39.3 0 2 c1 7: 2.3 1.3 180.0 13.2 0.0 0.1 0.0 39.3 0 2 c1t0d0 8: 2.3 1.3 180.0 13.2 0.0 0.1 0.0 39.3 0 2 c1t0d0s0 9: 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 c1t0d0s2 10: 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 c1t0d0s8 11: 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 c1t0d0p0 12: 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 c1t0d0p1 13: 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 fd0 14: extended device statistics 15: r/s w/s kr/s kw/s wait actv wsvc_t asvc_t %w %b device 16: 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 c0 17: 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 c0t0d0 18: 0.1 6.9 0.5 20.4 0.0 0.0 0.0 1.4 0 0 c1 19: 0.1 6.9 0.5 20.4 0.0 0.0 0.0 1.4 0 0 c1t0d0 20: 0.1 6.9 0.5 20.4 0.0 0.0 0.0 1.4 0 0 c1t0d0s0 21: 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 c1t0d0s2 22: 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 c1t0d0s8 23: 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 c1t0d0p0 24: 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 c1t0d0p1 25: 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 fd0 26: ^C$%b ディスクビジー率
・ネットワーク通信量 – netstat -i
1: $ netstat -in 10 2: input e1000g output input (Total) output 3: packets errs packets errs colls packets errs packets errs colls 4: 9152 0 7588 0 0 9317 0 7753 0 0 5: 29 0 28 0 0 29 0 28 0 0 6: 1859 0 3575 0 0 1859 0 3575 0 0 7: 2541 0 5060 0 0 2541 0 5060 0 0 8: 11560 0 22968 0 0 11560 0 22968 0 0 9: 15123 0 30140 0 0 15123 0 30140 0 0 10: 19 0 19 0 0 19 0 19 0 0 11: 14 0 14 0 0 14 0 14 0 0 12: ^C$input:packets 受信パケット数
output:packets 送信パケット数
・プロセス状態 – ps
1: $ while true; do2: > ps -eo ruser,pid,ppid,s,pcpu,pmem,vsz,rss,stime,time,nice,pri,tty,args
3: > sleep 10
4: > done
5: RUSER PID PPID S %CPU %MEM VSZ RSS STIME TIME NI PRI TT COMMAND 6: root 0 0 T 0.0 0.0 0 0 16:12:02 00:21 SY 96 ? sched 7: root 1 0 S 0.0 0.2 2496 740 16:12:05 00:00 20 59 ? /sbin/init 8: root 2 0 S 0.0 0.0 0 0 16:12:05 00:06 SY 98 ? pageout 9: root 3 0 S 0.1 0.0 0 0 16:12:05 00:02 SY 60 ? fsflush 10: root 164 1 S 0.0 0.4 3832 1900 16:12:20 00:00 20 59 ? /usr/lib/picl/picld 11: root 7 1 S 0.0 1.3 13076 6688 16:12:07 00:06 20 59 ? /lib/svc/bin/svc.startd 12: root 9 1 S 0.0 1.1 11260 5840 16:12:07 00:12 20 59 ? /lib/svc/bin/svc.configd 13: root 370 7 S 0.0 0.2 2072 840 16:12:29 00:00 20 59 ? /usr/lib/saf/sac -t 300 14: root 235 1 S 0.0 0.2 2372 692 16:12:22 00:00 20 59 ? /lib/svc/method/iscsid 15: root 271 1 S 0.0 0.2 2864 844 16:12:23 00:00 20 59 ? /usr/sbin/cron 16: root 394 370 S 0.0 0.2 2456 1048 16:12:30 00:00 20 59 ? /usr/lib/saf/ttymon 17: daemon 157 1 S 0.0 0.4 4344 2064 16:12:20 00:00 20 59 ? /usr/lib/crypto/kcfd 18: (略)・JavaVM ヒープ使用量 – jmap –heap
「jmap –heap pid」で、ヒープサマリーを定期的に出力。
1: # while true; do2: > /usr/java/bin/jmap -heap 830 2>/dev/null
3: > sleep 10
4: > done
5: 6: using thread-local object allocation. 7: Parallel GC with 4 thread(s) 8: 9: Heap Configuration: 10: MinHeapFreeRatio = 40 11: MaxHeapFreeRatio = 70 12: MaxHeapSize = 134217728 (128.0MB) 13: NewSize = 655360 (0.625MB) 14: MaxNewSize = 4294901760 (4095.9375MB) 15: OldSize = 1441792 (1.375MB) 16: NewRatio = 8 17: SurvivorRatio = 32 18: PermSize = 16777216 (16.0MB) 19: MaxPermSize = 67108864 (64.0MB) 20: 21: Heap Usage: 22: PS Young Generation 23: Eden Space: 24: capacity = 13828096 (13.1875MB) 25: used = 7330048 (6.990478515625MB) 26: free = 6498048 (6.197021484375MB) 27: 53.00836789099526% used 28: From Space: 29: capacity = 1507328 (1.4375MB) 30: used = 617960 (0.5893325805664062MB) 31: free = 889368 (0.8481674194335938MB) 32: 40.99704908288044% used 33: To Space: 34: capacity = 1441792 (1.375MB) 35: used = 0 (0.0MB) 36: free = 1441792 (1.375MB) 37: 0.0% used 38: PS Old Generation 39: capacity = 10485760 (10.0MB) 40: used = 6878688 (6.560028076171875MB) 41: free = 3607072 (3.439971923828125MB) 42: 65.60028076171875% used 43: PS Perm Generation 44: capacity = 25165824 (24.0MB) 45: used = 18436536 (17.58245086669922MB) 46: free = 6729288 (6.417549133300781MB) 47: 73.26021194458008% used 48: ^C#・JDBC 同時接続数(DBサーバ上で) – netstat -a
Oracle のインストールディレクトリ配下(通常は$ORACLE_HOME/network/admin 配下)にある「tnsnames.ora」で
定義されているポートに対するコネクションの数をカウント。
LISTEN の行も抽出されるので、解析の際には数値をデクリメントするとよい。
1: $ while true; do2: > netstat -an | grep '\.1521 ' | wc -l
3: > sleep 10
4: > done
5: 4 6: 4 7: ^C$まとめ
| CPU使用率(スレッド単位) | mpstat –q interval |
| CPUキュー数 | vmstat –q interval |
| メモリ使用率 | vmstat –q interval |
| ディスク稼働率(スライス単位) | iostat –xnmpC interval |
| ネットワーク通信量(インタフェース単位) | netstat –in interval |
| プロセス状態 | while true; do ps –eo options sleep interval done |
| JavaVM ヒープ使用量 | while true; do path_to_the/jmap –heap pid 2>/dev/null sleep interval done |
| JDBC 同時接続数 | while true; do netstat –an | grep '\.port ' | wc –l sleep interval done |
いずれの項目に対しての dtrace による採取方法も勉強中。
参考:
http://java.sun.com/javase/ja/6/docs/ja/technotes/tools/share/jmap.html
Solaris™ Performance and Tools
http://www.amazon.com/Solaris-Performance-Tools-Techniques-OpenSolaris/dp/0131568191
http://www.amazon.co.jp/Solaris-Performance-Tools-Techniques-OpenSolaris/dp/0131568191
0 件のコメント:
コメントを投稿