iT邦幫忙

7

Solaris 10 DTrace 的應用

  • 分享至 

  • xImage
  •  

Solaris 10 上的 DTrace 功能提供了其他作業系統尚未能提供的透明度。透過一個實例來示範並介紹 DTrace。

問題:

在 Solaris 10 上想知道不知名的程式到底在做什麼?

線索:

noaccess   674     1   0 01:04:27 ?           0:32 /usr/java/bin/java -server -Xmx -XX:+BackgroundCompilation -XX:PermSize=

準備:

先行安裝 DTraceToolkit,假設是安裝在 /opt/DTraceToolkit-0.99 (參考資料附有下載網址)

探索:

開啟一個視窗執行:
root@N-Wing:/ # ps -ef | grep java
noaccess   674     1   0 01:04:27 ?           0:32 /usr/java/bin/java -server -Xmx -XX:+BackgroundCompilation -XX:PermSize=

找到 PID 是 674

檢視它目前開啟的檔案:
root@N-Wing:/ # pfiles 674
674:    /usr/java/bin/java -server -Xmx -XX:+BackgroundCompilation -XX:Per
  Current rlimit: 65536 file descriptors
...
   7: S_IFSOCK mode:0666 dev:280,0 ino:33294 uid:0 gid:0 size:0
      O_RDWR
        SOCK_STREAM
        SO_REUSEADDR,SO_SNDBUF(49152),SO_RCVBUF(49152),IP_NEXTHOP(0.192.0.0)
        sockname: AF_INET 127.0.0.1  port: 6788
...
  10: S_IFSOCK mode:0666 dev:280,0 ino:33292 uid:0 gid:0 size:0
      O_RDWR
        SOCK_STREAM
        SO_REUSEADDR,SO_SNDBUF(49152),SO_RCVBUF(49152),IP_NEXTHOP(0.192.0.0)
        sockname: AF_INET 127.0.0.1  port: 6789
...
        
如果要取得處理程序的參數及環境變數的話:
root@N-Wing:/ # pargs -ae 674 | more
...
        
確認 TCP 的狀態:
root@N-Wing:/ # netstat -an | egrep '(6788|6789)'
127.0.0.1.6788             *.*                0      0 49152      0 LISTEN
127.0.0.1.6789             *.*                0      0 49152      0 LISTEN
        
開啟一個視窗執行 dtruss:
root@N-Wing:/ # /opt/DTraceToolkit-0.99/dtruss -p 674
...
resolvepath("/var/webconsole/domains/console/work/com_sun_web_console/localhost/console/com/sun/web/console\0", 0xB8ED8DA8, 0x400)
...

在另外的視窗執行 opensnoop:
root@N-Wing:/ # /opt/DTraceToolkit-0.99/opensnoop -p 674
...
60002    674 java          20 /var/webconsole/domains/console/work/com_sun_web_console/localhost/console/loader/com/sun/web/console/resources/RoleResources_zh_TW.properties
...

在另外的視窗執行 connections:
root@N-Wing:/ # /opt/DTraceToolkit-0.99/Bin/connections
  UID   PID CMD          TYPE  PORT IP_SOURCE
...
60002   674 java          tcp 65535 .0
...

使用本機的瀏灠器連該主機的 6789 連接埠:       
https://localhost:6789

答案:

原來是 Java Web Console

資料來源:http://blog.xuite.net/evereasy/solarpower/19400612


圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

2 則留言

0
insider
iT邦研究生 5 級 ‧ 2008-10-08 11:14:23

Regarding the DTrace, the better way is you should have the Solaris 10 or Opensolaris 10 source codes on-hands before you can get full pictures about the details of DTrace and Solaris 10.

The true case like that, support team used "Team Quest" to do the performance troubleshoot in potential customer site, after two months data collection and analysis just got nothing since it can not tell. Guru from headquarter deployed DTrace ( this guy is very familiar with Source codes of Solaris 10 ) in two weeks then found out ZFS caused the performance issue in Solaris 10 + SUN CMT servers. ZFS alwasy has problems work with certain database engines ( like Oracle and Sybase )

After that, end-user canceled the deals and Sales get fired.

0
davistai
iT邦大師 1 級 ‧ 2008-10-08 23:12:35

謝謝Evereasy大的分享和Insider大的故事!

我要留言

立即登入留言