Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't change tomcat 7 heap size

I have set the heap size of tomcat 7 by adding the following line in catalina.sh

export CATALINA_OPTS="-Xms512m -Xmx1024m"

then stopped and started the tomcat. but when tried to get the heap size using the command jmap -heap , i can notice that the memory doesn't change:

Heap Configuration:
   MinHeapFreeRatio = 40
   MaxHeapFreeRatio = 70
   MaxHeapSize      = 526385152 (502.0MB)
   NewSize          = 1048576 (1.0MB)
   MaxNewSize       = 4294901760 (4095.9375MB)
   OldSize          = 4194304 (4.0MB)
   NewRatio         = 2
   SurvivorRatio    = 8
   PermSize         = 16777216 (16.0MB)
   MaxPermSize      = 67108864 (64.0MB)

Heap Usage:
PS Young Generation
Eden Space:
   capacity = 99352576 (94.75MB)
   used     = 9643144 (9.196418762207031MB)
   free     = 89709432 (85.55358123779297MB)
   9.705982862487632% used
From Space:
   capacity = 4063232 (3.875MB)
   used     = 0 (0.0MB)
   free     = 4063232 (3.875MB)
   0.0% used
To Space:
   capacity = 5177344 (4.9375MB)
   used     = 0 (0.0MB)
   free     = 5177344 (4.9375MB)
   0.0% used
PS Old Generation
   capacity = 37748736 (36.0MB)
   used     = 21889008 (20.874984741210938MB)
   free     = 15859728 (15.125015258789062MB)
   57.98606872558594% used
PS Perm Generation
   capacity = 60948480 (58.125MB)
   used     = 31496008 (30.03693389892578MB)
   free     = 29452472 (28.08806610107422MB)
   51.67644541750672% used

please advise.

like image 508
Mahmoud Saleh Avatar asked Jun 18 '11 18:06

Mahmoud Saleh


People also ask

What is the default heap size in Tomcat 7?

By default, the maximum heap size value is 256 MB.

What is the maximum heap size for Tomcat?

The Tomcat server is run within a Java Virtual Machine (JVM). This JVM that controls the amount of memory available to LabKey Server. LabKey recommends that the Tomcat web application be configured to have a maximum Java Heap size of at least 2GB for a test server, and at least 4GB for a production server.


1 Answers

sudo vi /etc/default/tomcat7

Find the line that begins JAVA_OPTS="-Djava.awt.headless=true

and change the piddly -Xmx128m to -Xms512m -Xmx1024m

If you have more than one core...-XX:+UseConcMarkSweepGC is probably what you want.

like image 191
spanky Avatar answered Oct 02 '22 01:10

spanky