Increasing Heap Space of Grails Application Deployed on Tomcat Server in Windows OS

1.5k Views Asked by At

I have created an extensive Grails Web Application using lot of Plugins. I deployed this application on Tomcat Server (version-08), But as the records started growing, I get Java Heap Memory errors such as:

  1. OutOfMemoryError occurred when processing request
  2. JobExecutionException: java.lang.OutOfMemoryError: Java heap space
  3. java.lang.IllegalStateException: Already value for key bound to thread
  4. Error processing GroovyPageView: Error executing tag : Java heap space

I have tried lot of things available on web regarding increasing heap space allocated to my Tomcat Server, such as:

  1. Creating file 'setenv.bat' in tomcat/bin directory with content 'setx JAVA_OPTS="-server -Xmx1024m"'
  2. Setting System Environment Variable. Name:CATALINA_OPTS Value:-Xms256m -Xmx1024m
  3. setting these variables using 'set' and 'setx' command.
  4. Added the following line as very first line in my BuildConfig.Groovy file:

    grails.tomcat.jvmArgs= ["-Xms512m", "-Xmx1024m", "-XX:PermSize=512m", "-XX:MaxPermSize=1024m"]

I am Using Java-Melody to monitor the requests, memory, thread processes. I use this to check this: enter image description here

P.S. In my Server Machine there are multiple Tomcat Server Installed on which different multiple applications are deployed. Secondly, I succeeded to increase my permGen Memory by writting: -XX:PermSize=512m -XX:MaxPermSize=1024m in Tomcat Java Configurations.

Any Help regarding this will be highly appreciated.

1

There are 1 best solutions below

0
On

You can set memory limits with bin/tomcat7w.exe tool, in the Java tab.

However, I have not tried it with Tomcat 8 or with multiple Tomcat instances on the same server.

Hope this helps...