Unable to resize tomcat 7 heap size

I set the tomcat 7 heap size by adding the following line to catalina.sh

 export CATALINA_OPTS="-Xms512m -Xmx1024m" 

then stopped and started tomcat. but when I try to get the heap size using the jmap -heap command, I can notice that the memory does not 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 inform.

+12
linux tomcat tomcat7 heap-memory
Jun 18 '11 at 18:32
source share
5 answers

Set optional export JAVA_OPTS="-Dcom.sun.management.jmxremote" and use JConsole to check tomcats memory consumption.

+2
Jun 18 '11 at 18:37
source share
 sudo vi /etc/default/tomcat7 

Find the line starting with JAVA_OPTS="-Djava.awt.headless=true

and change piddly -Xmx128m to -Xms512m -Xmx1024m

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

+60
Sep 19 '12 at 23:41
source share

Do not change catalina.sh !! This file should not be modified by the user. Tomcat updates can override it. Instead, create the file " setenv.sh " in your "$ CATALINA_BASE / bin" (in the same folder as catalina.sh ). Set all your environment variables there.

setenv.sh is an optional file. If it exists, it is imported using catalina.sh . And the name says what you put there. This is a good place to initialize your $ CATALINA_OPTS, $ JAVA_OPTS, etc.

PS Generally speaking, you should avoid configuring files that can be modified with the provided package / distribution, and there is an alternative approach to customization. In this case, files such as catalina.sh , /etc/tomcat7/tomcat7.conf , /etc/init.d/tomcatX , etc., can be updated silently, and you won’t even notice that your configuration changes are rolled back .

+45
Jun 08 2018-12-12T00:
source share

how about editing etc / default / tomcat7

 # You may pass JVM startup parameters to Java here. If unset, the default # options will be: -Djava.awt.headless=true -Xmx128m -XX:+UseConcMarkSweepGC # # Use "-XX:+UseConcMarkSweepGC" to enable the CMS garbage collector (improved # response time). If you use that option and you run Tomcat on a machine with # exactly one CPU chip that contains one or two cores, you should also add # the "-XX:+CMSIncrementalMode" option. JAVA_OPTS="-Djava.awt.headless=true -Xmx1280m -XX:+UseConcMarkSweepGC" 
+17
May 2 '13 at 12:58
source share

Go to catalina.sh

Add this line to the top.

 JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server -Xms512m -Xmx1024m -XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m -XX:MaxPermSize=256m -XX:+DisableExplicitGC" 

Then start your tomcat using startup.sh

+1
Dec 07 '11 at 7:50
source share



All Articles