Where Do I Set the Eden Space?

Abdennour TOUMI picture Abdennour TOUMI · Dec 7, 2014 · Viewed 9.9k times · Source

Issue Summary :

Memmory size displayed near PS Eden Space is 639.5 MB WHILE JAVA_OPTS contains -Xms2558m -Xmx2558m (2.5G) .


Details :

After creating seten.sh file , i add this line :

export JAVA_OPTS="-Dfile.encoding=UTF-8 -Xms2558m -Xmx2558m -XX:PermSize=2558m -XX:MaxPermSize=2558m -XX:+HeapDumpOnOutOfMemoryError 

Then , i monitor the UI of Application server to check this increase of memory is for what

enter image description here

I was wondred: Why when i browse to my application why PS Old Gen remains stable while PS Eden Space consume memory quickly . However , Memmory size displayed near PS Eden Space is 639.5 MB .

How to increase PS Eden Space? What option should i use known that we use Java8 ?

When i set -Xms2558m : Is it too much known that my app is a grails application(includes spring framework,spring security,...)

Answer

Olaf Kock picture Olaf Kock · Dec 7, 2014

Several issues:

-Xms sets the initial Heap space and has nothing to do with Eden space. That's what the JVM allocates on startup. If more is required, it allocates up to -Xmx later, but this applies to the total heap space, not one of the GC generation spaces (those will be part of the heap)

You can configure the ratio of young and old generation with -XX:NewRatio=. Check the documentation for your JVM, if it's Oracle's this might suffice, others might have better links. You'll find a lot of GC tutorials and articles all over the net.

When you read them: as far as I'm concerned, Young and Eden are often used synonymously.

A permanent generation space of 2.5G sounds like waaaaay too large - and you should use CATALINA_OPTS to set the tomcat configuration, not JAVA_OPTS.