`
m2000hsf
  • 浏览: 97214 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论
阅读更多
今天系统突然收到错误日志:
Feb 12, 2012 1:28:40 AM org.apache.tomcat.util.net.JIoEndpoint processSocket
SEVERE: Error allocating socket processor
java.lang.OutOfMemoryError: unable to create new native thread
        at java.lang.Thread.start0(Native Method)
        at java.lang.Thread.start(Thread.java:640)
        at java.util.concurrent.ThreadPoolExecutor.addIfUnderCorePoolSize(ThreadPoolExecutor.java:703)
        at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:652)
        at org.apache.catalina.core.StandardThreadExecutor.execute(StandardThreadExecutor.java:82)
        at org.apache.tomcat.util.net.JIoEndpoint.processSocket(JIoEndpoint.java:729)
        at org.apache.tomcat.util.net.JIoEndpoint$Acceptor.run(JIoEndpoint.java:313)
        at java.lang.Thread.run(Thread.java:662)


于是,利用jprofiler7来测试一下web应用,说到这个分析工具,得详细介绍一下:
是一个全功能的 Java 剖析工具( profiler ),专用于分析 J2SE 和 J2EE 应用程序。它把 CPU 、执行绪和内存的剖析组合在一个强大的 应用中。 JProfiler 可提供许多 IDE 整合和应用服务器整合用途。 JProfiler 直觉式的 GUI 让你可以找到效能瓶颈、抓出内存漏失 (memory leaks) 、并解决执行绪的问题。它让你得以对 heap walker 作资源回收器的 root analysis ,可以轻易找出内存溢出; heap 快照( snapshot )模式让未被参照( reference )的对象、稍微被参照的对象、或在终结( finalization )队列的对象 都会被移除;整合精灵以便剖析浏览器的 Java 外挂功能。


步骤:
1、下载jprofiler7,地址:http://www.ej-technologies.com/download/jprofiler/files.html
linux 版与client windows的
2、服务器端 JProfiler 安装:
把 jprofiler_linux_7.sh 上传到到服务器,假设路径为 /opt/jprofiler
# cd /opt/jprofiler
# chmod +x *.sh 
# ./jprofiler_linux_7.sh -c

按照提示来安装,提示都很简单,不在多说。安装路径选择 /opt/jprofiler7
3、客户端连接配置
1). 运行 JProfiler 。第一次打开会有向导,忽略它。
2). 选择 Session->Integration Wizard->New Remote Integratation
3). 选择 On a remote computer;Platform of remote computer 选择 Linux x86/AMD 64;Next
4). 输入服务器 IP ;Next
5). 输入服务器上的 jprofiler 的安装路径,如 /opt/jprofiler4 ;next
6). 选择服务器的 JDK 环境,这里是:IBM,1.6.0,hotspot;next
7). 输入端口:这里是默认值 8849;next
8). 选择启动模式:这里选第一种 wait for a connection from the jprofiler GUI;next
9). 这里会列出需要在服务器端做的配置:

4、服务器端的配置
(1)修改系统环境配置文件 /etc/profile ,增加
JPROFILER_HOME=/opt/jprofiler7/bin/linux-x86
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JPROFILER_HOME

(2)修改TOMCAT启动文件catalina.sh,添加
export LD_LIBRARY_PATH=/opt/jprofiler7/bin/linux-x86
JAVA_OPTS=' -Xms500m -Xmx2000m -XX:PermSize=64M -XX:MaxPermSize=128m -agentlib:jprofilerti=port=8849   -Xbootclasspath/a:/opt/jprofiler7/bin/agent.jar '

(3)Reboot Linux and startup Tomcat using startup.sh;
JProfiler> Protocol version 23
JProfiler> Using JVMTI
JProfiler> 32-bit library
JProfiler> Listening on port: 8849.
JProfiler> Native library initialized
JProfiler> Waiting for a connection from the   JProfiler GUI 

5.启动客户端软件
   点击jprofiler菜单 session>start center>Open Session
   Available session configurations中列出了刚才配置的连接,选中使用就OK了!!
1
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics