十五年测试老手,长期负责WEB\APP 项目测试,目前主要负责团队管理工作。

YourKit Java Profiler 剖析远程服务器

上一篇 / 下一篇  2011-05-19 21:51:10 / 个人分类:java性能分析

YourKit Java Profiler 比 JProfiler 要好安装,特别是在剖析远程服务器上

&_R:~\n2_ eKP(BT0

先到 YourKit.Java.Profiler.v9.0.3.For.Windows.Linux 下载 windowslinux 版。51Testing软件测试网C k+IyHp7TI

把都解压到不同的目录如 D:\profile\YourKit.Java.Profiler.v9.0.3.Incl.Keygen.and 和
j-e(M%UXh&_d@0D:\profile\YourKit.Java.Profiler.v9.0.3.Linux.Incl.Keygen.and。

K#L]y"\0

1、解压出 yjp-9.0.3.exe 安装。完了后,双击 D:\profile\YourKit.Java.Profiler.v9.0.3.Incl.Keygen.and\iNViSiBLE\keygen.bat 然后点“patch”,然后选择 D:\Program Files\YourKit Java Profiler 9.0.3\lib\yjp.jar

WfqIwR0B)Z)? n0

2、输入用户名,点“Gengerate”,复制出 key。51Testing软件测试网YZ9K8X!` b&|

3、运行 yourkit profiler,输入刚才复制出的 key 就好了。

F/k@lKq~N0

然后就可正常运行了。51Testing软件测试网qoAz3dw G8Go

剖析远程服务器还需要在 linux 的安装 yourkit profiler(以控制台行动不需要 License),把解压出来的 yjp-9.0.3-linux.tar.bz2 上传到服务器,如:/home/admin/yjp-9.0.3-linux.tar.bz251Testing软件测试网k1k"b,X8\C{9g

1、在 linux 解压 yjp-9.0.3-linux.tar.bz2,并运行。

9ML^Z'd0
  1. cd /home/admin/  
  2. tar xfj yjp-9.0.3-linux.tar.bz2  
  3. cd yjp-9.0.3  
  4. #生成启动脚本  
  5. java -jar lib/yjp.jar -integrate  

在生成启动脚本期间,要选择。如下:

W` a9\:o~j8hNm0
  1. [admin@v022185 ~/yjp-9.0.3]$ java -jar lib/yjp.jar -integrate  
  2. Choose server to integrate with:  
  3. 1) Geronimo  
  4. 2) JBoss 2.x/3.x/4.x  
  5. 3) Jetty HTTP Server 5.x  
  6. 4) JRun 4  
  7. 5) Orion Application Server 1.5.x/2.x  
  8. 6) Resin 2.x/3.x  
  9. 7) Sun Application Server / GlassFish  
  10. 8) Tomcat 3/4/5/6  
  11. 9) WebLogic 9/10  
  12. 10) WebSphere Application Server 7  
  13. 11) Generic server (use if your server is not on the list)  
  14. Enter number which corresponds to your server (0 to exit) and press Enter:  
  15. >2  
  16. Please specify whether the server runs on a 32-bit JVM or a 64-bit JVM.  
  17. Hint: If you are not sure what to choose, choose "32-bit JVM". If with this choice the server does not start with profiling, re-run the integration and choose "64-bit Java" option.  
  18. 1) 32-bit JVM  
  19. 2) 64-bit JVM  
  20. >2  
  21. Location of JBoss startup script (<JBOSS_HOME>/bin/run.sh):  
  22. >/home/admin/yjp-9.0.3/jboss_run.sh  
  23.   
  24. Startup options configuration: step 1 of 5  
  25. Should option 'disablestacktelemetry' be specified?  
  26. 1) Yes (recommended to minimize profiling overhead in production)  
  27. 2) No  
  28. >1  
  29. Startup options configuration: step 2 of 5  
  30. Should option 'disableexceptiontelemetry' be specified?  
  31. 1) Yes (recommended to minimize profiling overhead in production)  
  32. 2) No  
  33. >1  
  34. Startup options configuration: step 3 of 5  
  35. Should option 'builtinprobes=none' be specified?  
  36. 1) Yes (recommended to minimize profiling overhead in production)  
  37. 2) No  
  38. >1  
  39. Startup options configuration: step 4 of 5  
  40. Should option 'delay=10000' be specified?  
  41. 1) Yes (recommended)  
  42. 2) No  
  43. >1  
  44. Startup options configuration: step 5 of 5  
  45. Please specify comma-separated list of additional startup options, or press Enter for no additional options:  
  46. >  
  47. Startup script to be used for profiling has been successfully created:  
  48.   
  49. /home/admin/yjp-9.0.3/jboss_run_with_yjp.sh  

其实就在 jboss_run_with_yjp.sh 加个 jvm 启动参数:

GE'`8k2[0
  1. -agentpath:/home/admin/yjp-9.0.3/bin/linux-x86-64/libyjpagent.so=disablestacktelemetry,disableexceptiontelemetry,builtinprobes=none,delay=10000,sessionname=JBoss  

可以参数自己的环境手动写,sessionname 是随便写吧(没验证过)。

|,a@gxD0

用带 yjp 参数启动 jboss。就可以剖析远程服务器。

2T~&_n] JD$C {0

在本地机 windows 用界面观察。在欢迎界面中有个 “Connect to remote application ...” 链接。可以输入 host:post。51Testing软件测试网HpO\ D:q \

注意 yourkit 的是在 10001 - 10010 中按顺序来决定哪个端口使用(有点不理解为什么不在启动 jvm 参数中指定)。

#^g5}P I0

比如:192.168.1.100:10001。然后就可以看到界面了:51Testing软件测试网kk'c Xxgt

yourkit-profiler

yourkit profiler 界面

`5n.vZ#[ o/i9aZ'B`0

TAG: YourKit

 

评分:0

我来说两句

Open Toolbar