user496934
user496934

Reputation: 4020

Setting heap size in Tomcat

I am working on the apache tomcat server in unix enviroment. I want to increase the heap size of my application and so I am setting it in the catalina.sh file . This is how I am doing it ...

export CATALINA_OPTS="-Xms1024m -Xmx1024m" echo $CATALINA_OPTS

When i call the startup.sh it calls catalina.sh and sets the variable CATALINA_OPTS to 1024 as indicated by the echo statement in the script. But if I do echo $CATALINA_OPTS at the command prompt it gives blank. Is this expected behavior. How can I be sure that the correct heap value has indeed been picked up ?

Upvotes: 3

Views: 5453

Answers (2)

lobster1234
lobster1234

Reputation: 7779

Yes, $CATALINA_OPTS will not be available outside of the script thats executed by the shell. In order to get the correct heap size, you need a profiler, or use jmap to get heap info - here 39196 is the PID of the tomcat process on my machine.

mpandit-mbp:~ mpandit$ jmap -heap 39196
Attaching to process ID 39196, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 19.1-b02-334

using parallel threads in the new generation.
using thread-local object allocation.
Concurrent Mark-Sweep GC

Heap Configuration:
   MinHeapFreeRatio = 40
   MaxHeapFreeRatio = 70
   MaxHeapSize      = 132120576 (126.0MB)
   NewSize          = 21757952 (20.75MB)
   MaxNewSize       = 87228416 (83.1875MB)
   OldSize          = 65404928 (62.375MB)
   NewRatio         = 7
   SurvivorRatio    = 8
   PermSize         = 21757952 (20.75MB)
   MaxPermSize      = 85983232 (82.0MB)

Upvotes: 3

Yasin Bahtiyar
Yasin Bahtiyar

Reputation: 2367

$ ps aux | grep tomcat command should display actual settings picked by tomcat.

Upvotes: 0

Related Questions