JVM Tuning - CMS behavior





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







1















Currently I'm running an application in Tomcat 7 with the following jvm arguments:



-Dcatalina.home=E:Tomcat
-Dcatalina.base=E:Tomcat
-Djava.endorsed.dirs=E:Tomcatendorsed
-Djava.io.tmpdir=E:TomcatEtemp
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.util.logging.config.file=E:Tomcatconflogging.properties
-XX:MaxPermSize=512m
-XX:PermSize=512m
-XX:+UseConcMarkSweepGC
-XX:NewSize=7g
-XX:MaxTenuringThreshold=31
-XX:CMSInitiatingOccupancyFraction=90
-XX:+UseCMSInitiatingOccupancyOnly
-XX:SurvivorRatio=6
-XX:TargetSurvivorRatio=90
-verbose:gc -XX:+PrintGCDetails
-XX:+PrintGCApplicationStoppedTime
-XX:+PrintGCDateStamps
-Xloggc:E:Tomcat7gc.log


I'm using CMS as garbage collector and the behavior seems to be very strange. Even having 13GB of Old generation, when a major collection is performed (I guess at 90% of occupied space -> -XX:CMSInitiatingOccupancyFraction=90) , CMS is not able to clean a large amount of objects (still having occupied space of at least 7GB). I don't believe that application has so many long-lived objects (not sure!). Is it not supposed that CMS release much more space? Or could be something related to fragmentation?



Because of this behavior I'm having frequent CMS cycles...that I would like to decrease.



Even using a low pause GC, sometimes application stops 15-30 secs... How can I decrease pause time in CMS?
Could be a good idea to have more JVMS instead of having one with 20GB of heap?



Thanks a lot










share|improve this question























  • do you really need 7GB heap? Reasonable for GC IS 2 GB. Max 4gb , can you pls post gc log. I am worry that you should decrease CMSInitiatingOccupancyFraction because it looks like that CMs is not able to make major collection and switch to serial one, are you sure that there is no memory leek?

    – JosefN
    Dec 31 '13 at 17:47













  • The heap size is 20GB. The application is generating almost 5GB of objects in each minute (high-load and a lot of short-lived objects are created).I'll add the GC log in another post. Thanks!

    – user3149848
    Dec 31 '13 at 17:57













  • Please find in this URL the GC log www17.zippyshare.com/v/42614853/file.html

    – user3149848
    Dec 31 '13 at 18:09




















1















Currently I'm running an application in Tomcat 7 with the following jvm arguments:



-Dcatalina.home=E:Tomcat
-Dcatalina.base=E:Tomcat
-Djava.endorsed.dirs=E:Tomcatendorsed
-Djava.io.tmpdir=E:TomcatEtemp
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.util.logging.config.file=E:Tomcatconflogging.properties
-XX:MaxPermSize=512m
-XX:PermSize=512m
-XX:+UseConcMarkSweepGC
-XX:NewSize=7g
-XX:MaxTenuringThreshold=31
-XX:CMSInitiatingOccupancyFraction=90
-XX:+UseCMSInitiatingOccupancyOnly
-XX:SurvivorRatio=6
-XX:TargetSurvivorRatio=90
-verbose:gc -XX:+PrintGCDetails
-XX:+PrintGCApplicationStoppedTime
-XX:+PrintGCDateStamps
-Xloggc:E:Tomcat7gc.log


I'm using CMS as garbage collector and the behavior seems to be very strange. Even having 13GB of Old generation, when a major collection is performed (I guess at 90% of occupied space -> -XX:CMSInitiatingOccupancyFraction=90) , CMS is not able to clean a large amount of objects (still having occupied space of at least 7GB). I don't believe that application has so many long-lived objects (not sure!). Is it not supposed that CMS release much more space? Or could be something related to fragmentation?



Because of this behavior I'm having frequent CMS cycles...that I would like to decrease.



Even using a low pause GC, sometimes application stops 15-30 secs... How can I decrease pause time in CMS?
Could be a good idea to have more JVMS instead of having one with 20GB of heap?



Thanks a lot










share|improve this question























  • do you really need 7GB heap? Reasonable for GC IS 2 GB. Max 4gb , can you pls post gc log. I am worry that you should decrease CMSInitiatingOccupancyFraction because it looks like that CMs is not able to make major collection and switch to serial one, are you sure that there is no memory leek?

    – JosefN
    Dec 31 '13 at 17:47













  • The heap size is 20GB. The application is generating almost 5GB of objects in each minute (high-load and a lot of short-lived objects are created).I'll add the GC log in another post. Thanks!

    – user3149848
    Dec 31 '13 at 17:57













  • Please find in this URL the GC log www17.zippyshare.com/v/42614853/file.html

    – user3149848
    Dec 31 '13 at 18:09
















1












1








1








Currently I'm running an application in Tomcat 7 with the following jvm arguments:



-Dcatalina.home=E:Tomcat
-Dcatalina.base=E:Tomcat
-Djava.endorsed.dirs=E:Tomcatendorsed
-Djava.io.tmpdir=E:TomcatEtemp
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.util.logging.config.file=E:Tomcatconflogging.properties
-XX:MaxPermSize=512m
-XX:PermSize=512m
-XX:+UseConcMarkSweepGC
-XX:NewSize=7g
-XX:MaxTenuringThreshold=31
-XX:CMSInitiatingOccupancyFraction=90
-XX:+UseCMSInitiatingOccupancyOnly
-XX:SurvivorRatio=6
-XX:TargetSurvivorRatio=90
-verbose:gc -XX:+PrintGCDetails
-XX:+PrintGCApplicationStoppedTime
-XX:+PrintGCDateStamps
-Xloggc:E:Tomcat7gc.log


I'm using CMS as garbage collector and the behavior seems to be very strange. Even having 13GB of Old generation, when a major collection is performed (I guess at 90% of occupied space -> -XX:CMSInitiatingOccupancyFraction=90) , CMS is not able to clean a large amount of objects (still having occupied space of at least 7GB). I don't believe that application has so many long-lived objects (not sure!). Is it not supposed that CMS release much more space? Or could be something related to fragmentation?



Because of this behavior I'm having frequent CMS cycles...that I would like to decrease.



Even using a low pause GC, sometimes application stops 15-30 secs... How can I decrease pause time in CMS?
Could be a good idea to have more JVMS instead of having one with 20GB of heap?



Thanks a lot










share|improve this question














Currently I'm running an application in Tomcat 7 with the following jvm arguments:



-Dcatalina.home=E:Tomcat
-Dcatalina.base=E:Tomcat
-Djava.endorsed.dirs=E:Tomcatendorsed
-Djava.io.tmpdir=E:TomcatEtemp
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.util.logging.config.file=E:Tomcatconflogging.properties
-XX:MaxPermSize=512m
-XX:PermSize=512m
-XX:+UseConcMarkSweepGC
-XX:NewSize=7g
-XX:MaxTenuringThreshold=31
-XX:CMSInitiatingOccupancyFraction=90
-XX:+UseCMSInitiatingOccupancyOnly
-XX:SurvivorRatio=6
-XX:TargetSurvivorRatio=90
-verbose:gc -XX:+PrintGCDetails
-XX:+PrintGCApplicationStoppedTime
-XX:+PrintGCDateStamps
-Xloggc:E:Tomcat7gc.log


I'm using CMS as garbage collector and the behavior seems to be very strange. Even having 13GB of Old generation, when a major collection is performed (I guess at 90% of occupied space -> -XX:CMSInitiatingOccupancyFraction=90) , CMS is not able to clean a large amount of objects (still having occupied space of at least 7GB). I don't believe that application has so many long-lived objects (not sure!). Is it not supposed that CMS release much more space? Or could be something related to fragmentation?



Because of this behavior I'm having frequent CMS cycles...that I would like to decrease.



Even using a low pause GC, sometimes application stops 15-30 secs... How can I decrease pause time in CMS?
Could be a good idea to have more JVMS instead of having one with 20GB of heap?



Thanks a lot







garbage-collection






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Dec 31 '13 at 17:33









user3149848user3149848

61




61













  • do you really need 7GB heap? Reasonable for GC IS 2 GB. Max 4gb , can you pls post gc log. I am worry that you should decrease CMSInitiatingOccupancyFraction because it looks like that CMs is not able to make major collection and switch to serial one, are you sure that there is no memory leek?

    – JosefN
    Dec 31 '13 at 17:47













  • The heap size is 20GB. The application is generating almost 5GB of objects in each minute (high-load and a lot of short-lived objects are created).I'll add the GC log in another post. Thanks!

    – user3149848
    Dec 31 '13 at 17:57













  • Please find in this URL the GC log www17.zippyshare.com/v/42614853/file.html

    – user3149848
    Dec 31 '13 at 18:09





















  • do you really need 7GB heap? Reasonable for GC IS 2 GB. Max 4gb , can you pls post gc log. I am worry that you should decrease CMSInitiatingOccupancyFraction because it looks like that CMs is not able to make major collection and switch to serial one, are you sure that there is no memory leek?

    – JosefN
    Dec 31 '13 at 17:47













  • The heap size is 20GB. The application is generating almost 5GB of objects in each minute (high-load and a lot of short-lived objects are created).I'll add the GC log in another post. Thanks!

    – user3149848
    Dec 31 '13 at 17:57













  • Please find in this URL the GC log www17.zippyshare.com/v/42614853/file.html

    – user3149848
    Dec 31 '13 at 18:09



















do you really need 7GB heap? Reasonable for GC IS 2 GB. Max 4gb , can you pls post gc log. I am worry that you should decrease CMSInitiatingOccupancyFraction because it looks like that CMs is not able to make major collection and switch to serial one, are you sure that there is no memory leek?

– JosefN
Dec 31 '13 at 17:47







do you really need 7GB heap? Reasonable for GC IS 2 GB. Max 4gb , can you pls post gc log. I am worry that you should decrease CMSInitiatingOccupancyFraction because it looks like that CMs is not able to make major collection and switch to serial one, are you sure that there is no memory leek?

– JosefN
Dec 31 '13 at 17:47















The heap size is 20GB. The application is generating almost 5GB of objects in each minute (high-load and a lot of short-lived objects are created).I'll add the GC log in another post. Thanks!

– user3149848
Dec 31 '13 at 17:57







The heap size is 20GB. The application is generating almost 5GB of objects in each minute (high-load and a lot of short-lived objects are created).I'll add the GC log in another post. Thanks!

– user3149848
Dec 31 '13 at 17:57















Please find in this URL the GC log www17.zippyshare.com/v/42614853/file.html

– user3149848
Dec 31 '13 at 18:09







Please find in this URL the GC log www17.zippyshare.com/v/42614853/file.html

– user3149848
Dec 31 '13 at 18:09














1 Answer
1






active

oldest

votes


















0














First, you can dump the heap dump file with:



jmap -heap:live heap.bin ${pid}


command and find the long-lived objects by mat



Second, because the heap size is bigger than 8G and you can try Garbage First(G1) Collector






share|improve this answer


























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f20861110%2fjvm-tuning-cms-behavior%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    First, you can dump the heap dump file with:



    jmap -heap:live heap.bin ${pid}


    command and find the long-lived objects by mat



    Second, because the heap size is bigger than 8G and you can try Garbage First(G1) Collector






    share|improve this answer






























      0














      First, you can dump the heap dump file with:



      jmap -heap:live heap.bin ${pid}


      command and find the long-lived objects by mat



      Second, because the heap size is bigger than 8G and you can try Garbage First(G1) Collector






      share|improve this answer




























        0












        0








        0







        First, you can dump the heap dump file with:



        jmap -heap:live heap.bin ${pid}


        command and find the long-lived objects by mat



        Second, because the heap size is bigger than 8G and you can try Garbage First(G1) Collector






        share|improve this answer















        First, you can dump the heap dump file with:



        jmap -heap:live heap.bin ${pid}


        command and find the long-lived objects by mat



        Second, because the heap size is bigger than 8G and you can try Garbage First(G1) Collector







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 25 '18 at 3:17









        Stephen Rauch

        30.5k153760




        30.5k153760










        answered Nov 25 '18 at 2:59









        javadujavadu

        113




        113
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f20861110%2fjvm-tuning-cms-behavior%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            這個網誌中的熱門文章

            Xamarin.form Move up view when keyboard appear

            Post-Redirect-Get with Spring WebFlux and Thymeleaf

            Anylogic : not able to use stopDelay()