日期:2014-05-17  浏览次数:20813 次

当tomcat注册为windows服务时候,怎样配置tomcat的内存
一般用tomcat做服务器的时候,总是会有内存不够的情况,如果以startup.bat启动的tomcat设置内存将会很简单,当以服务启动的时候设置的办法为:

1; Go to run box and run regedit;
2; HKEY_LOCAL_MACHINE/SOFTWARE/Apache Software Foundation/Procrun 2.0/Tomcat7/Parameters/Java
3;Add the Items: JvmMs and JvmMx and put the memory size you want.

查看内存使用状态:
1,修改TOMCAT_HOME/conf/tomcat-users.xml
<role rolename="tomcat"/>
  <role rolename="role1"/>
  <role rolename="manager-gui"/>
  <role rolename="manager-status"/>
  <user username="tomcat" password="tomcat" roles="tomcat"/>
  <user username="both" password="tomcat" roles="tomcat,role1"/>
  <user username="role1" password="tomcat" roles="role1"/>
  <user username="tomcat" password="tomcat" roles="manager-gui"/>
  <user username="tomcat" password="tomcat" roles="manager-gui"/>

2,Go to : localhost:8080/manager/status

这里是我修改前后的对比
修改前:
Free memory: 33.04 MB Total memory: 78.01 MB Max memory: 247.50 MB
修改后:
Free memory: 419.52 MB Total memory: 515.37 MB Max memory: 1254.75 MB