在tomcat中查看JVM内存使用情况

TOMCAT在运行过程中可以实时监控当前应用JVM的占用情况。TOMCAT本身带的应用manager可以进行服务器状态的监控。为了运行该程序,需要创建角色manager和对应的用户。
创建位置在conf/tomcat-users.xml中,内容如下所示:
<?xml version=&apos;1.0&apos; encoding=&apos;utf-8&apos;?>                                                                     
<tomcat-users>                                                                                                             
  <role rolename="tomcat"/>                                                                                       
  <role rolename="role1"/>                                                                                          
  <role rolename="manager"/>                                                                                   
  <role rolename="admin"/>                                                                                        
  <user username="tomcat" password="tomcat" roles="tomcat"/>                    
  <user username="both" password="tomcat" roles="tomcat,role1"/>              
  <user username="role1" password="tomcat" roles="role1"/>                          
  <user username="admin" password="tomcat" roles="admin,manager"/>   
</tomcat-users>                                                                                                           
创建了角色manager和用户admin/tomcat后就可以使用manager应用了。
在IE中键入httpp://localhost:8080,进入tomcat的主界面,然后选择左面的 Administration     
 
下的Tomcat Manager,输入用户名和密码(admin/tomcat),就进入了manager的界面,
选择最右方的“Server Status”,便可以看到JVM的占用情况。
Free memory: 3.69 MB Total memory: 10.60 MB Max memory: 63.31 MB
Free memory:当前可用的内存;
Total memory:当前已经分配的JVM内存;
Max memory:当前允许分配的最大JVM内存;
 
本文来自CSDN博客,转载请标明出处:

作者: xue2   发布时间: 2010-12-16