I have a Grails app deployed on tomcat7.0.23 on a 64-bit vm, and it keeps running out of mem.
The app is a plain is it can be:
Grails version: 2.0.0
Groovy version: 1.8.4
JVM version: 1.6.0_29
Controllers: 24
Domains: 9
Services: 10
Tag Libraries: 22
Our /etc/tomcat7/tomcat.conf is as follows:
#********************************************************************
# Wrapper Properties
#********************************************************************
# Java Application
set.JAVA_HOME=/usr/java/j2sdk
wrapper.java.command=%JAVA_HOME%/bin/java
set.TOMCAT_HOME=/opt/tomcat7
set.TOMCAT_LOG=/var/log/tomcat7
# Use new ticker
wrapper.use_system_time=FALSE
wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperStartStopApp
# Java Classpath (include wrapper.jar) Add class path elements as
# needed starting from 1
wrapper.java.classpath.1=%TOMCAT_HOME%/lib/wrapper.jar
wrapper.java.classpath.2=%JAVA_HOME%/lib/tools.jar
wrapper.java.classpath.3=%TOMCAT_HOME%/bin/bootstrap.jar
wrapper.java.classpath.4=%TOMCAT_HOME%/bin/commons-daemon.jar
wrapper.java.classpath.5=%TOMCAT_HOME%/bin/tomcat-juli.jar
# Java Library Path (location of Wrapper.DLL or libwrapper.so)
wrapper.java.library.path.1=%TOMCAT_HOME%/lib
# Java Additional Parameters
wrapper.java.additional.1=-server
wrapper.java.additional.2=-Dcatalina.base=%TOMCAT_HOME%
wrapper.java.additional.3=-Dcatalina.home=%TOMCAT_HOME%
wrapper.java.additional.4=-XX:MaxPermSize=256m
wrapper.java.additional.5=-XX:+CMSPermGenSweepingEnabled
wrapper.java.additional.6=-XX:+CMSClassUnloadingEnabled
# Initial Java Heap Size (in MB)
wrapper.java.initmemory=64
# Maximum Java Heap Size (in MB)
wrapper.java.maxmemory=384
# Application parameters. Add parameters as needed starting from 1
# The first application parameter is the name of the class whose main
# method is to be called when the application is launched. The class
# name is followed by the number of parameters to be passed to its main
# method. Then comes the actual parameters.
wrapper.app.parameter.1=org.apache.catalina.startup.Bootstrap
wrapper.app.parameter.2=1
wrapper.app.parameter.3=start
# The start parameters are followed by the name of the class whose main
# method is to be called to stop the application. The stop class name
# is followed by a flag which controls whether or not the Wrapper should
# wait for all non daemon threads to complete before exiting the JVM.
# The flag is followed by the number of parameters to be passed to the
# stop class's main method. Finally comes the actual parameters.
wrapper.app.parameter.4=org.apache.catalina.startup.Bootstrap
wrapper.app.parameter.5=true
wrapper.app.parameter.6=1
wrapper.app.parameter.7=stop
#********************************************************************
# Wrapper Logging Properties
#********************************************************************
# Format of output for the console. (See docs for formats)
wrapper.console.format=PM
# Log Level for console output. (See docs for log levels)
wrapper.console.loglevel=INFO
# Log file to use for wrapper output logging.
wrapper.logfile=%TOMCAT_LOG%/catalina.out
# Format of output for the log file. (See docs for formats)
wrapper.logfile.format=LPTM
# Log Level for log file output. (See docs for log levels)
wrapper.logfile.loglevel=INFO
# Maximum size that the log file will be allowed to grow to before
# the log is rolled. Size is specified in bytes. The default value
# of 0, disables log rolling. May abbreviate with the 'k' (kb) or
# 'm' (mb) suffix. For example: 10m = 10 megabytes.
wrapper.logfile.maxsize=0
# Maximum number of rolled log files which will be allowed before old
# files are deleted. The default value of 0 implies no limit.
wrapper.logfile.maxfiles=0
# Log Level for sys/event log output. (See docs for log levels)
wrapper.syslog.loglevel=NONE
#********************************************************************
# Wrapper NT Service Properties
#********************************************************************
# WARNING - Do not modify any of these properties when an application
# using this configuration file has been installed as a service.
# Please uninstall the service before modifying this section. The
# service can then be reinstalled.
# Name of the service
wrapper.ntservice.name=@app.name@
# Display name of the service
wrapper.ntservice.displayname=@app.long.name@
# Description of the service
wrapper.ntservice.description=@app.description@
# Service dependencies. Add dependencies as needed starting from 1
wrapper.ntservice.dependency.1=
# Mode in which the service is installed. AUTO_START or DEMAND_START
wrapper.ntservice.starttype=AUTO_START
# Allow the service to interact with the desktop.
wrapper.ntservice.interactive=false
In addition when I run top I'm getting
Tasks: 97 total, 1 running, 96 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.1%us, 0.0%sy, 0.0%ni, 99.8%id, 0.1%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 1548608k total, 1158516k used, 390092k free, 155036k buffers
Swap: 1048568k total, 0k used, 1048568k free, 400772k cached
This morning I changed the following:
wrapper.java.additional.4=-XX:MaxPermSize=256m
from 128m and
# Maximum Java Heap Size (in MB)
wrapper.java.maxmemory=384
from 128
The app is running with Grails-Melody plugin (of Java-Melody origins) and the amount of info it offers is rather overwhelming.
Is there anything else I can do setting wise to improve performance here? Is there any other info I provide here that would be helpful?