Java – using a very large heap

I’ve heard several times peoples saying that it’s so easy to improve the performance of a java application by increasing the heap values to several gigabytes of memory; I even know a cache architecture which took more than 10 GB of RAM (single JVM, 64bits). No one thought before what will be the consequences when the garbage collector will “stop the world” and the application will not respond for several seconds. I found an article describing this problem on Billy Newport blog – very interesting and with lot of details.

5 Responses to “Java – using a very large heap”

  1. Alex Says:

    Nu este usor sa maresti dimensiunea heap-ului deoarece cu un heap mai mare GC-ul ajunge sa ia mai mult timp.

    Ideal GC-ul n-ar trebui sa ia mai mult de 15% din timpul aplicatiei si un heap mare poate inrautati foarte rau situatia … asta se intampla mai ales cand alocarile de memorie fragmenteaza memoria, deoarece cu cat heap-ul mai mare cu atat dureaza mai mult defragmentarea.

    O serie de articole bestiala despre tuning-ul JVM-ului este pe site-ul celor de la IBM: http://www-128.ibm.com/developerworks/views/java/libraryview.jsp?search_by=eye+performance:

    PS: de ce scrie toata lumea in engleza pe bloguri? :)

  2. cornel Says:

    Hi Alex,

    I agree with you regarding the total time spent in GC however I believe that for several kinds of applications the most unpleasant thing is the “stop the world” phase when everything is suspended – if it takes several seconds that means disaster for an application server.

    I liked Billy Newport suggestion about malloc/free – I thought about that before reading his article.

    Thanks for the links – if there are peoples interested about this subject I will add another ones regarding tuning/configuring JVM

    And I’m writing in English because not everyone understands Romanian :)

  3. Robert Munteanu Says:

    Hey Cornel,

    -XX:+UseConcMarkSweepGC is your friend ( when using the Sun JVM, anyway ). “Stop the world” is something which you shouldn’t worry about. And the Garbage First (G1) collector hopefully landing in Java 7 will make things even better.

    Robert

  4. cornel Says:

    Hi Robert,

    Thanks for sharing this. I’m curious, can you give us more details regarding your scenario (when you have some time available)? I mean the size of the heap, if the data from cache is changing very fast or not, the system architecture.

  5. Robert Munteanu Says:

    I can tell you that we’ve jumped over 10G heap by quite some margin ;)

    The heap has a stable and large old generation , with the young generation being promoted rather slowly.

Leave a Reply