Manoj
Manoj

Reputation: 5612

Tomcat JVM memory tweaking

I'm using tomcat7 and jvm memory options are set to

-Xms2048m -Xmx2048m 
-XX:NewSize=256m -XX:MaxNewSize=256m 
-XX:PermSize=256m -XX:MaxPermSize=256m 

with these settings server failed to start with error

Error occurred during initialization of VM
Too small initial heap for new size specified

Its same even if I increase NewSize to 512 or 1024, it works only if I remove the NewSize option. Foor heap size of 2048MB, are these valid sizes?

Upvotes: 3

Views: 7204

Answers (2)

Ravi
Ravi

Reputation: 159

I am having 4gb ram 64 bit. I too got the same error but fixed with this configuration. set JAVA_OPTS=%JAVA_OPTS% -Xms2560m

set JAVA_OPTS=%JAVA_OPTS% -Xmx2560m
set JAVA_OPTS=%JAVA_OPTS% -XX:NewSize=1280m
set JAVA_OPTS=%JAVA_OPTS% -XX:MaxNewSize=1280m
set JAVA_OPTS=%JAVA_OPTS% -XX:PermSize=400m
set JAVA_OPTS=%JAVA_OPTS% -XX:MaxPermSize=400m
set JAVA_OPTS=%JAVA_OPTS% -XX:+UseCompressedOops
set JAVA_OPTS=%JAVA_OPTS% -XX:+UseParNewGC
set JAVA_OPTS=%JAVA_OPTS% -XX:+DisableExplicitGC
set JAVA_OPTS=%JAVA_OPTS% -XX:+UseConcMarkSweepGC
set JAVA_OPTS=%JAVA_OPTS% -XX:SurvivorRatio=6
set JAVA_OPTS=%JAVA_OPTS% -XX:+CMSClassUnloadingEnabled
set JAVA_OPTS=%JAVA_OPTS% -Dsun.rmi.dgc.client.gcInterval=3600000
set JAVA_OPTS=%JAVA_OPTS% -Dsun.rmi.dgc.server.gcInterval=3600000

Upvotes: 0

Aleš
Aleš

Reputation: 9028

Remove the NewSize parameters and then monitor the occupancy of the YoungGen while runing your app. Based on the size of the YoungGen you can then go back and change the parameters to the optimal value.

Use e.g. gc logging and/or jstat to see the occupancy of the each region in the heap.

Also, check that your parameters are properly parsed by the VM, e.g. instead of 256MB of YoungGen JVM could thinks you want 256B.

Upvotes: 1

Related Questions