标签:tomcat
架构:
254.150:负载均衡
163.130:tomcat
163.140:tomcat,memcached
163.120:memcache
192.168.163.130
(接上)
[root@node2 ~]# catalina.sh version
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/java/latest
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Server version: Apache Tomcat/8.0.30
Server built: Dec 1 2015 22:30:46 UTC
Server number: 8.0.30.0
OS Name: Linux
OS Version: 2.6.32-573.el6.x86_64
Architecture: amd64
JVM Version: 1.7.0_67-b01
JVM Vendor: Oracle Corporation
You have mail in /var/spool/mail/root
[root@node2 ~]# catalina.sh stop
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/java/latest
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
移走更改原始配置
[root@node2 ~]# cd /usr/local/tomcat/conf/
[root@node2 conf]# ls
Catalina catalina.properties logging.properties server.xml.bak tomcat-users.xml web.xml
catalina.policy context.xml server.xml server.xml.cluster tomcat-users.xsd
[root@node2 conf]# mv server.xml server.xml.cluster
mv:是否覆盖"server.xml.cluster"? yes
[root@node2 conf]# cp server.xml.bak server.xml
重启
[root@node2 conf]# catalina.sh start
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/java/latest
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Tomcat started.
[root@node2 conf]# ss -tnl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 100 :::8009 :::*
LISTEN 0 100 :::8080 :::*
LISTEN 0 128 :::22 :::*
LISTEN 0 128 *:22 *:*
LISTEN 0 128 127.0.0.1:631 *:*
LISTEN 0 128 ::1:631 :::*
LISTEN 0 100 ::1:25 :::*
LISTEN 0 100 127.0.0.1:25 *:*
LISTEN 0 128 127.0.0.1:6010 *:*
LISTEN 0 128 ::1:6010 :::*
LISTEN 0 128 127.0.0.1:6011 *:*
下载程序到文件中并传至root目录
http://repo1.maven.org/maven2/de/javakaffee/msm/memcached-session-manager-tc8
memcached-session-manager-tc8-1.8.3.jar
http://repo1.maven.org/maven2/de/javakaffee/msm/
memcached-session-manager-1.8.3.jar
http://repo1.maven.org/maven2/de/javakaffee/msm/msm-javolution-serializer/1.8.3/
msm-javolution-serializer-1.8.3.jar
[root@node2 ~]# ls
anaconda-ks.cfg install.log.syslog memcached-session-manager-1.8.3.jar ntpupdate.sh 模板 文档 桌面
apache-tomcat-8.0.30.tar.gz javolution-5.5.1.jar memcached-session-manager-tc8-1.8.3.jar spymemcached-2.10.2.jar 视频 下载
install.log jdk-7u67-linux-x64.rpm msm-javolution-serializer-1.8.3 (1).jar 公共的 图片 音乐
[root@node2 ~]# mv msm-javolution-serializer-1.8.3\ \(1\).jar msm-javolution-serializer-1.8.3.jar
[root@node2 ~]# ls
anaconda-ks.cfg install.log.syslog memcached-session-manager-1.8.3.jar ntpupdate.sh 模板 文档 桌面
apache-tomcat-8.0.30.tar.gz javolution-5.5.1.jar memcached-session-manager-tc8-1.8.3.jar spymemcached-2.10.2.jar 视频 下载
install.log jdk-7u67-linux-x64.rpm msm-javolution-serializer-1.8.3.jar 公共的 图片 音乐
[root@node2 ~]# cp mem* javolution-5.5.1.jar msm-javolution-serializer-1.8.3.jar spymemcached-2.10.2.jar /usr/local/tomcat/lib/
You have mail in /var/spool/mail/root
[root@node2 ~]# ls /usr/local/tomcat/lib/
annotations-api.jar ecj-4.4.2.jar memcached-session-manager-1.8.3.jar tomcat-coyote.jar tomcat-jni.jar
catalina-ant.jar el-api.jar memcached-session-manager-tc8-1.8.3.jar tomcat-dbcp.jar tomcat-util.jar
catalina-ha.jar jasper-el.jar msm-javolution-serializer-1.8.3.jar tomcat-i18n-es.jar tomcat-util-scan.jar
catalina.jar jasper.jar servlet-api.jar tomcat-i18n-fr.jar tomcat-websocket.jar
catalina-storeconfig.jar javolution-5.5.1.jar spymemcached-2.10.2.jar tomcat-i18n-ja.jar websocket-api.jar
catalina-tribes.jar jsp-api.jar tomcat-api.jar tomcat-jdbc.jar
[root@node2 ~]# scp mem* javolution-5.5.1.jar msm-javolution-serializer-1.8.3.jar spymemcached-2.10.2.jar 192.168.163.140:/usr/local/tomcat/lib/
The authenticity of host ‘192.168.163.140 (192.168.163.140)‘ can‘t be established.
RSA key fingerprint is 0e:95:8d:de:b9:2f:c4:75:8d:70:af:e2:84:65:7f:86.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘192.168.163.140‘ (RSA) to the list of known hosts.
root@192.168.163.140‘s password:
memcached-session-manager-1.8.3.jar 100% 144KB 143.6KB/s 00:00
memcached-session-manager-tc8-1.8.3.jar 100% 10KB 10.2KB/s 00:00
javolution-5.5.1.jar 100% 386KB 385.9KB/s 00:00
msm-javolution-serializer-1.8.3.jar 100% 69KB 69.4KB/s 00:00
spymemcached-2.10.2.jar 100% 429KB 428.8KB/s 00:00
查看
[root@node2 lib]# ll
总用量 8300
-rw-r--r--. 1 root root 17353 12月 2 2015 annotations-api.jar
-rw-r--r--. 1 root root 53033 12月 2 2015 catalina-ant.jar
-rw-r--r--. 1 root root 120063 12月 2 2015 catalina-ha.jar
-rw-r--r--. 1 root root 1549955 12月 2 2015 catalina.jar
-rw-r--r--. 1 root root 74655 12月 2 2015 catalina-storeconfig.jar
-rw-r--r--. 1 root root 270671 12月 2 2015 catalina-tribes.jar
-rw-r--r--. 1 root root 2310271 12月 2 2015 ecj-4.4.2.jar
-rw-r--r--. 1 root root 81428 12月 2 2015 el-api.jar
-rw-r--r--. 1 root root 161367 12月 2 2015 jasper-el.jar
-rw-r--r--. 1 root root 586127 12月 2 2015 jasper.jar
-rw-r--r--. 1 root root 395195 11月 24 06:35 javolution-5.5.1.jar
-rw-r--r--. 1 root root 61417 12月 2 2015 jsp-api.jar
-rw-r--r--. 1 root root 147025 11月 24 06:35 memcached-session-manager-1.8.3.jar
-rw-r--r--. 1 root root 10407 11月 24 06:35 memcached-session-manager-tc8-1.8.3.jar
-rw-r--r--. 1 root root 71051 11月 24 06:35 msm-javolution-serializer-1.8.3.jar
-rw-r--r--. 1 root root 244281 12月 2 2015 servlet-api.jar
-rw-r--r--. 1 root root 439107 11月 24 06:35 spymemcached-2.10.2.jar
-rw-r--r--. 1 root root 9278 12月 2 2015 tomcat-api.jar
-rw-r--r--. 1 root root 709499 12月 2 2015 tomcat-coyote.jar
-rw-r--r--. 1 root root 244813 12月 2 2015 tomcat-dbcp.jar
-rw-r--r--. 1 root root 67841 12月 2 2015 tomcat-i18n-es.jar
-rw-r--r--. 1 root root 41471 12月 2 2015 tomcat-i18n-fr.jar
-rw-r--r--. 1 root root 43588 12月 2 2015 tomcat-i18n-ja.jar
-rw-r--r--. 1 root root 135946 12月 2 2015 tomcat-jdbc.jar
-rw-r--r--. 1 root root 31475 12月 2 2015 tomcat-jni.jar
-rw-r--r--. 1 root root 105125 12月 2 2015 tomcat-util.jar
-rw-r--r--. 1 root root 201024 12月 2 2015 tomcat-util-scan.jar
-rw-r--r--. 1 root root 214115 12月 2 2015 tomcat-websocket.jar
-rw-r--r--. 1 root root 36603 12月 2 2015 websocket-api.jar
创建文件目录
[root@node2 webapps]# mkdir -pv myapp/{WEB-INF,classes,lib,META-INF}
mkdir: 已创建目录 "myapp"
mkdir: 已创建目录 "myapp/WEB-INF"
mkdir: 已创建目录 "myapp/classes"
mkdir: 已创建目录 "myapp/lib"
mkdir: 已创建目录 "myapp/META-INF"
You have mail in /var/spool/mail/root
[root@node2 webapps]# ll
总用量 28
drwxr-xr-x. 14 root root 4096 12月 16 2015 docs
drwxr-xr-x. 6 root root 4096 12月 16 2015 examples
drwxr-xr-x. 5 root root 4096 12月 16 2015 host-manager
drwxr-xr-x. 5 root root 4096 12月 16 2015 manager
drwxr-xr-x. 6 root root 4096 11月 24 06:46 myapp
drwxr-xr-x. 3 root root 4096 12月 16 2015 ROOT
drwxr-xr-x. 6 root root 4096 11月 23 07:37 testapp
[root@node2 webapps]# cd myapp/ && ll
总用量 16
drwxr-xr-x. 2 root root 4096 11月 24 06:46 classes
drwxr-xr-x. 2 root root 4096 11月 24 06:46 lib
drwxr-xr-x. 2 root root 4096 11月 24 06:46 META-INF
drwxr-xr-x. 2 root root 4096 11月 24 06:46 WEB-INF
[root@node2 myapp]# vim index.jsp
1 <%@ page language="java" %>
2 <html>
3 <head><title>TomcatA</title></head>
4 <body>
5 <h1><font color="red">TomcatA.zye.com</font></h1>
6 <table align="centre" border="1">
7 <tr>
8 <td>Session ID</td>
9 <% session.setAttribute("zye.com","zye.com"); %>
10 <td><%= session.getId() %></td>
11 </tr>
12 <tr>
13 <td>Created on</td>
14 <td><%= session.getCreationTime() %></td>
15 </tr>
16 </table>
17 </body>
18 </html>
关闭服务,删除work缓存
[root@node2 myapp]# catalina.sh stop
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/java/latest
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
You have mail in /var/spool/mail/root
[root@node2 myapp]# rm -rf ../../work/Catalina/localhost/*
192.168.163.140
[root@node3 ~]# catalina.sh stop
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/java/latest
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
You have new mail in /var/spool/mail/root
移走更改原始配置
[root@node3 ~]# cd /usr/local/tomcat/conf/
You have new mail in /var/spool/mail/root
[root@node3 conf]# ls
Catalina catalina.properties logging.properties server.xml.bak tomcat-users.xml web.xml
catalina.policy context.xml server.xml server.xml.cluster tomcat-users.xsd
[root@node3 conf]# cp server.xml server.xml.cluster
cp:是否覆盖"server.xml.cluster"? yes
[root@node3 conf]# cp server.xml.bak server.xml
cp:是否覆盖"server.xml"? yes
重启
[root@node3 conf]# catalina.sh start
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/java/latest
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Tomcat started.
You have new mail in /var/spool/mail/root
[root@node3 conf]# ss -tnl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 100 :::8009 :::*
LISTEN 0 128 *:38828 *:*
LISTEN 0 128 :::111 :::*
LISTEN 0 128 *:111 *:*
LISTEN 0 100 :::8080 :::*
LISTEN 0 128 :::33717 :::*
LISTEN 0 128 :::22 :::*
LISTEN 0 128 *:22 *:*
LISTEN 0 128 127.0.0.1:631 *:*
LISTEN 0 128 ::1:631 :::*
LISTEN 0 100 ::1:25 :::*
LISTEN 0 100 127.0.0.1:25 *:*
LISTEN 0 128 127.0.0.1:6010 *:*
LISTEN 0 128 ::1:6010 :::*
LISTEN 0 128 127.0.0.1:6011 *:*
LISTEN 0 128 ::1:6011 :::*
安装,启动memcached
[root@node3 conf]# yum install memcached -y
[root@node3 conf]# service memcached start
正在启动 memcached: [确定]
[root@node3 conf]# ss -tunl |grep 11211
udp UNCONN 0 0 *:11211 *:*
udp UNCONN 0 0 :::11211 :::*
tcp LISTEN 0 128 :::11211 :::*
tcp LISTEN 0 128 *:11211 *:*
[root@node3 conf]# telnet 127.0.0.1 11211
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is ‘^]‘.
stats
STAT pid 19266
STAT uptime 120
STAT time 1451437141
STAT version 1.4.4
STAT pointer_size 64
STAT rusage_user 0.000000
STAT rusage_system 0.216967
STAT curr_connections 10
STAT total_connections 11
STAT connection_structures 11
[root@node3 lib]# ll
总用量 8300
-rw-r--r--. 1 root root 17353 12月 2 06:31 annotations-api.jar
-rw-r--r--. 1 root root 53033 12月 2 06:31 catalina-ant.jar
-rw-r--r--. 1 root root 120063 12月 2 06:31 catalina-ha.jar
-rw-r--r--. 1 root root 1549955 12月 2 06:31 catalina.jar
-rw-r--r--. 1 root root 74655 12月 2 06:31 catalina-storeconfig.jar
-rw-r--r--. 1 root root 270671 12月 2 06:31 catalina-tribes.jar
-rw-r--r--. 1 root root 2310271 12月 2 06:31 ecj-4.4.2.jar
-rw-r--r--. 1 root root 81428 12月 2 06:31 el-api.jar
-rw-r--r--. 1 root root 161367 12月 2 06:31 jasper-el.jar
-rw-r--r--. 1 root root 586127 12月 2 06:31 jasper.jar
-rw-r--r--. 1 root root 395195 12月 30 09:55 javolution-5.5.1.jar
-rw-r--r--. 1 root root 61417 12月 2 06:31 jsp-api.jar
-rw-r--r--. 1 root root 147025 12月 30 09:55 memcached-session-manager-1.8.3.jar
-rw-r--r--. 1 root root 10407 12月 30 09:55 memcached-session-manager-tc8-1.8.3.jar
-rw-r--r--. 1 root root 71051 12月 30 09:55 msm-javolution-serializer-1.8.3.jar
-rw-r--r--. 1 root root 244281 12月 2 06:31 servlet-api.jar
-rw-r--r--. 1 root root 439107 12月 30 09:55 spymemcached-2.10.2.jar
-rw-r--r--. 1 root root 9278 12月 2 06:31 tomcat-api.jar
-rw-r--r--. 1 root root 709499 12月 2 06:31 tomcat-coyote.jar
-rw-r--r--. 1 root root 244813 12月 2 06:31 tomcat-dbcp.jar
-rw-r--r--. 1 root root 67841 12月 2 06:31 tomcat-i18n-es.jar
-rw-r--r--. 1 root root 41471 12月 2 06:31 tomcat-i18n-fr.jar
-rw-r--r--. 1 root root 43588 12月 2 06:31 tomcat-i18n-ja.jar
-rw-r--r--. 1 root root 135946 12月 2 06:31 tomcat-jdbc.jar
-rw-r--r--. 1 root root 31475 12月 2 06:31 tomcat-jni.jar
-rw-r--r--. 1 root root 105125 12月 2 06:31 tomcat-util.jar
-rw-r--r--. 1 root root 201024 12月 2 06:31 tomcat-util-scan.jar
-rw-r--r--. 1 root root 214115 12月 2 06:31 tomcat-websocket.jar
-rw-r--r--. 1 root root 36603 12月 2 06:31 websocket-api.jar
创建目录
[root@node3 lib]# cd ../webapps/
You have new mail in /var/spool/mail/root
[root@node3 webapps]# mkdir -pv myapp/{WEB-INF,META-INF,classes,lib}
mkdir: 已创建目录 "myapp"
mkdir: 已创建目录 "myapp/WEB-INF"
mkdir: 已创建目录 "myapp/META-INF"
mkdir: 已创建目录 "myapp/classes"
mkdir: 已创建目录 "myapp/lib"
[root@node3 webapps]# vim myapp/index.jsp
1 <%@ page language="java" %>
2 <html>
3 <head><title>TomcatB</title></head>
4 <body>
5 <h1><font color="blue">TomcatB.zye.com</font></h1>
6 <table align="centre" border="1">
7 <tr>
8 <td>Session ID</td>
9 <% session.setAttribute("zye.com","zye.com"); %>
10 <td><%= session.getId() %></td>
11 </tr>
12 <tr>
13 <td>Created on</td>
14 <td><%= session.getCreationTime() %></td>
15 </tr>
16 </table>
17 </body>
18 </html>
修改配置文件
[root@node3 webapps]# vim ../conf/server.xml
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true">
<Context path="/myapp" docBase="myapp" reloadable="true">
<Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager"
memcachedNodes="n1:192.168.163.120:11211,n2:192.168.163.140:11211"
failoverNodes="n1"
requestUriIgnorePattern=".*\.(ico|png|gif|jpg|css|js)$"
transcoderFactoryClass="de.javakaffee.web.msm.serializer.javolution.JavolutionTranscoderFactory"
/>
</Context>
复制server.xml到163.130
[root@node3 webapps]# scp ../conf/server.xml 192.168.163.130:/usr/local/tomcat/conf/
The authenticity of host ‘192.168.163.130 (192.168.163.130)‘ can‘t be established.
RSA key fingerprint is 0e:95:8d:de:b9:2f:c4:75:8d:70:af:e2:84:65:7f:86.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘192.168.163.130‘ (RSA) to the list of known hosts.
root@192.168.163.130‘s password:
Permission denied, please try again.
root@192.168.163.130‘s password:
server.xml 100% 6973 6.8KB/s 00:00
关闭服务,删除work缓存
[root@node3 webapps]# catalina.sh stop
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/java/latest
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
You have new mail in /var/spool/mail/root
[root@node3 webapps]# rm -rf ../work/Catalina/localhost/*
172.168.254.150(前端负载均衡)
[root@node200 ~]# service httpd restart
停止 httpd: [确定]
正在启动 httpd: [确定]
注意:版本问题否则不能缓存命中
JVM(java虚拟机)的运行时的内存调整
JVM HEAP内存空间:
新生代
新生区(Eden): 初创对象
存活区(Survivor):步入成熟期的初创对象
ss1:
ss2:
老年代:
mark --> compact
持久代
垃圾回收器:
新生代回收:
Minor GC
老年代回收:
Major GC (FULL GC)
堆内存空间的调整参数:
-Xmx: 新生代和老年代总共可用的最大空间
-Xms: 二者初始空间之和;
-XX:NewSize 新生代初始空间
-XX:MaxNewSize 新生代的最大空间
-XX:MaxPermSize 持久代最大空间
-XX:PermSize 持久代初始空间
/usr/local/tomcat/bin/catalina.sh
参数:java_opts 对所有的虚拟机 (包括他们tomcat等)
catalina.sh_opts 仅对其中的tomcat实例的jvm
[root@node2 bin]# export CATALINA_OPTS="-Xmx256m"
操作如下
jps (java virtual machine process status tool)
监控jvm进程状态信息
jps [options] [hostid]
-m: 输出传入main方法的参数
-l: 显示main类或jar的完全限定名称
-v: 显示为jvm虚拟机指定的参数
[root@node2 bin]# jps
13929 Jps
96604 Bootstrap
[root@node2 bin]# jps 96604
RMI Registry not available at 96604:1099
Exception creating connection to: 96604; nested exception is:
java.net.SocketException: Invalid argument or cannot assign requested address
You have mail in /var/spool/mail/root
[root@node2 bin]# jps -m -l
47612 sun.tools.jps.Jps -m -l
96604 org.apache.catalina.startup.Bootstrap start
You have mail in /var/spool/mail/root
[root@node2 bin]# jps -m -l -v
48127 sun.tools.jps.Jps -m -l -v -Dapplication.home=/usr/java/jdk1.7.0_67 -Xms8m
96604 org.apache.catalina.startup.Bootstrap start -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/usr/local/tomcat/endorsed -Dcatalina.base=/usr/local/tomcat -Dcatalina.home=/usr/local/tomcat -Djava.io.tmpdir=/usr/local/tomcat/temp
jstack: 查看某个java进程内的线程堆栈信息;
jstack [options] pid
-l long listings:输出完成的锁信息;
-m: 混合模式,即会输出java堆栈及C/C++堆栈信息
[root@node2 bin]# jstack 96604
[root@node2 bin]# jstack -l 96604
jmap和jhat:
jmap: jvm memory map,查看堆内存使用情况
jhat: java heap analysis tool
jmap [options] pid
-heap: 详细堆内存空间使用状态信息
-histo[:live] 查看堆内存中的对象数目、大小统计结果;
[root@node2 bin]# jmap 96604
Attaching to process ID 96604, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 24.65-b04
0x0000000000400000 7K /usr/java/jdk1.7.0_67/bin/java
0x00000032ee200000 153K /lib64/ld-2.12.so
0x00000032ee600000 22K /lib64/libdl-2.12.so
0x00000032eea00000 1881K /lib64/libc-2.12.so
0x00000032eee00000 142K /lib64/libpthread-2.12.so
0x00000032ef200000 46K /lib64/librt-2.12.so
0x00000032ef600000 585K /lib64/libm-2.12.so
0x00000032f9600000 91K /lib64/libgcc_s-4.4.7-20120601.so.1
0x00007f3c393c9000 250K /usr/java/jdk1.7.0_67/jre/lib/amd64/libsunec.so
0x00007f3c3971d000 44K /usr/java/jdk1.7.0_67/jre/lib/amd64/libmanagement.so
0x00007f3c39944000 112K /usr/java/jdk1.7.0_67/jre/lib/amd64/libnet.so
0x00007f3c39b5b000 89K /usr/java/jdk1.7.0_67/jre/lib/amd64/libnio.so
0x00007f3c4f9ac000 120K /usr/java/jdk1.7.0_67/jre/lib/amd64/libzip.so
0x00007f3c4fbc7000 64K /lib64/libnss_files-2.12.so
0x00007f3c4fdd5000 214K /usr/java/jdk1.7.0_67/jre/lib/amd64/libjava.so
0x00007f3c540e6000 63K /usr/java/jdk1.7.0_67/jre/lib/amd64/libverify.so
0x00007f3c543f5000 14853K /usr/java/jdk1.7.0_67/jre/lib/amd64/server/libjvm.so
0x00007f3c5526c000 103K /usr/java/jdk1.7.0_67/lib/amd64/jli/libjli.so
You have mail in /var/spool/mail/root
[root@node2 bin]# jmap -heap 96604
Attaching to process ID 96604, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 24.65-b04
using thread-local object allocation.
Mark Sweep Compact GC
Heap Configuration:
MinHeapFreeRatio = 40
MaxHeapFreeRatio = 70
MaxHeapSize = 257949696 (246.0MB)
NewSize = 1310720 (1.25MB)
MaxNewSize = 17592186044415 MB
OldSize = 5439488 (5.1875MB)
NewRatio = 2
SurvivorRatio = 8
PermSize = 21757952 (20.75MB)
MaxPermSize = 85983232 (82.0MB)
G1HeapRegionSize = 0 (0.0MB)
Heap Usage:
New Generation (Eden + 1 Survivor Space):
capacity = 10158080 (9.6875MB)
used = 7841544 (7.478279113769531MB)
free = 2316536 (2.2092208862304688MB)
77.1951392389113% used
Eden Space:
capacity = 9043968 (8.625MB)
used = 7622568 (7.269447326660156MB)
free = 1421400 (1.3555526733398438MB)
84.283447265625% used
From Space:
capacity = 1114112 (1.0625MB)
used = 218976 (0.208831787109375MB)
free = 895136 (0.853668212890625MB)
19.65475643382353% used
To Space:
capacity = 1114112 (1.0625MB)
used = 0 (0.0MB)
free = 1114112 (1.0625MB)
0.0% used
tenured generation:
capacity = 22499328 (21.45703125MB)
used = 21882232 (20.86852264404297MB)
free = 617096 (0.5885086059570312MB)
97.2572691948844% used
Perm Generation:
capacity = 24379392 (23.25MB)
used = 24283656 (23.15869903564453MB)
free = 95736 (0.09130096435546875MB)
99.60730768019154% used
13734 interned Strings occupying 1799784 bytes.
You have mail in /var/spool/mail/root
jstat:jvm统计监测工具
jstat -<option> [-t] [-h<lines>] <vmid> [<interval> [<count>]]
其中<option>为必须提供的选项,所有可用选项可使用jstat -options列出;
-class
-compiler
-gc
-gccapacity
-gccause
-gcnew
-gcnewcapacity
-gcold
-gcoldcapacity
-gcpermcapacity
-gcutil
-printcompilation
字段意义:
S0C, S1C, S0U, S1U: C表示容量,U表示已用量;
EC, EU:eden区域的容量和已用量;
OC, OU
PC, PU
YGC, YGT:新生代的GC次数和耗时;
FGC, FGCT: FULL GC的次数和耗时;
[root@node2 bin]# jstat -options
-class
-compiler
-gc
-gccapacity
-gccause
-gcnew
-gcnewcapacity
-gcold
-gcoldcapacity
-gcpermcapacity
-gcutil
-printcompilation
[root@node2 bin]# jstat -gc 96604
S0C S1C S0U S1U EC EU OC OU PC PU YGC YGCT FGC FGCT GCT
1344.0 1344.0 0.0 0.0 11136.0 2880.7 27600.0 16558.8 23744.0 23696.6 57 0.552 4 2.174 2.726
两个GUI工具:jconsole, jvisualvm
[root@node2 bin]# jconsole
You have mail in /var/spool/mail/root
[root@node2 bin]# jvisualvm
标签:tomcat
原文地址:http://youenstudy.blog.51cto.com/6722910/1732607