Configuration of the Xmx flag










0















Running a Java microservice in an environment you have to make/decide some configuration.
The configuration that I refer now is how to set the Xmx flag.
I consider that any type of instance you choose, you have to leave some RAM for the system and other programs.
I have a t2.medium (4 GB) AWS EB and I configured the Xmx flag for Java microservice to 3 GB.
After the load, the committed memory reaches a bit above 3.0 GB, around 3.1 GB. There are a lot of free memory. The problem is that AWS EB reports 97% RAM, this means that left memory is used for CloudWatch Agent, NGINX, Linux and maybe for other things.



If the values reaches or goes beyond 100%, something can be killed by Linux Kernel due to high usage of the RAM.



enter image description here



Question: Do you have any idea, the best practices in choosing the value for Xmx flag based on total available RAM of the machine? Do you decide it by doing experiments?



Thank you










share|improve this question




























    0















    Running a Java microservice in an environment you have to make/decide some configuration.
    The configuration that I refer now is how to set the Xmx flag.
    I consider that any type of instance you choose, you have to leave some RAM for the system and other programs.
    I have a t2.medium (4 GB) AWS EB and I configured the Xmx flag for Java microservice to 3 GB.
    After the load, the committed memory reaches a bit above 3.0 GB, around 3.1 GB. There are a lot of free memory. The problem is that AWS EB reports 97% RAM, this means that left memory is used for CloudWatch Agent, NGINX, Linux and maybe for other things.



    If the values reaches or goes beyond 100%, something can be killed by Linux Kernel due to high usage of the RAM.



    enter image description here



    Question: Do you have any idea, the best practices in choosing the value for Xmx flag based on total available RAM of the machine? Do you decide it by doing experiments?



    Thank you










    share|improve this question


























      0












      0








      0








      Running a Java microservice in an environment you have to make/decide some configuration.
      The configuration that I refer now is how to set the Xmx flag.
      I consider that any type of instance you choose, you have to leave some RAM for the system and other programs.
      I have a t2.medium (4 GB) AWS EB and I configured the Xmx flag for Java microservice to 3 GB.
      After the load, the committed memory reaches a bit above 3.0 GB, around 3.1 GB. There are a lot of free memory. The problem is that AWS EB reports 97% RAM, this means that left memory is used for CloudWatch Agent, NGINX, Linux and maybe for other things.



      If the values reaches or goes beyond 100%, something can be killed by Linux Kernel due to high usage of the RAM.



      enter image description here



      Question: Do you have any idea, the best practices in choosing the value for Xmx flag based on total available RAM of the machine? Do you decide it by doing experiments?



      Thank you










      share|improve this question
















      Running a Java microservice in an environment you have to make/decide some configuration.
      The configuration that I refer now is how to set the Xmx flag.
      I consider that any type of instance you choose, you have to leave some RAM for the system and other programs.
      I have a t2.medium (4 GB) AWS EB and I configured the Xmx flag for Java microservice to 3 GB.
      After the load, the committed memory reaches a bit above 3.0 GB, around 3.1 GB. There are a lot of free memory. The problem is that AWS EB reports 97% RAM, this means that left memory is used for CloudWatch Agent, NGINX, Linux and maybe for other things.



      If the values reaches or goes beyond 100%, something can be killed by Linux Kernel due to high usage of the RAM.



      enter image description here



      Question: Do you have any idea, the best practices in choosing the value for Xmx flag based on total available RAM of the machine? Do you decide it by doing experiments?



      Thank you







      java linux microservices ram amazon-elastic-beanstalk






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 12 '18 at 15:29







      Adrian

















      asked Nov 12 '18 at 15:22









      AdrianAdrian

      125110




      125110






















          1 Answer
          1






          active

          oldest

          votes


















          1














          There is no formula for tuning JVM. It is highly dependent on each specific machine, the application, application server, and usage pattern by end users. It is recommended that you set the same value for Xmx and Xms. You should try different values and profile JVM using JProfiler or Visual VM. This is an article for Liferay JVM tuning. Hopefully, it is useful and brings you some ideas.






          share|improve this answer























          • Thank you for your answer. I know I can do it very well using JProfiler with a deployed agent inside the env. I am interested in some best practices. The ultimate solution is by doing experiments.

            – Adrian
            Nov 13 '18 at 7:23











          • I am going to read your link.

            – Adrian
            Nov 13 '18 at 7:24










          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%2f53265179%2fconfiguration-of-the-xmx-flag%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









          1














          There is no formula for tuning JVM. It is highly dependent on each specific machine, the application, application server, and usage pattern by end users. It is recommended that you set the same value for Xmx and Xms. You should try different values and profile JVM using JProfiler or Visual VM. This is an article for Liferay JVM tuning. Hopefully, it is useful and brings you some ideas.






          share|improve this answer























          • Thank you for your answer. I know I can do it very well using JProfiler with a deployed agent inside the env. I am interested in some best practices. The ultimate solution is by doing experiments.

            – Adrian
            Nov 13 '18 at 7:23











          • I am going to read your link.

            – Adrian
            Nov 13 '18 at 7:24















          1














          There is no formula for tuning JVM. It is highly dependent on each specific machine, the application, application server, and usage pattern by end users. It is recommended that you set the same value for Xmx and Xms. You should try different values and profile JVM using JProfiler or Visual VM. This is an article for Liferay JVM tuning. Hopefully, it is useful and brings you some ideas.






          share|improve this answer























          • Thank you for your answer. I know I can do it very well using JProfiler with a deployed agent inside the env. I am interested in some best practices. The ultimate solution is by doing experiments.

            – Adrian
            Nov 13 '18 at 7:23











          • I am going to read your link.

            – Adrian
            Nov 13 '18 at 7:24













          1












          1








          1







          There is no formula for tuning JVM. It is highly dependent on each specific machine, the application, application server, and usage pattern by end users. It is recommended that you set the same value for Xmx and Xms. You should try different values and profile JVM using JProfiler or Visual VM. This is an article for Liferay JVM tuning. Hopefully, it is useful and brings you some ideas.






          share|improve this answer













          There is no formula for tuning JVM. It is highly dependent on each specific machine, the application, application server, and usage pattern by end users. It is recommended that you set the same value for Xmx and Xms. You should try different values and profile JVM using JProfiler or Visual VM. This is an article for Liferay JVM tuning. Hopefully, it is useful and brings you some ideas.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 12 '18 at 15:53









          AbdollahAbdollah

          10011




          10011












          • Thank you for your answer. I know I can do it very well using JProfiler with a deployed agent inside the env. I am interested in some best practices. The ultimate solution is by doing experiments.

            – Adrian
            Nov 13 '18 at 7:23











          • I am going to read your link.

            – Adrian
            Nov 13 '18 at 7:24

















          • Thank you for your answer. I know I can do it very well using JProfiler with a deployed agent inside the env. I am interested in some best practices. The ultimate solution is by doing experiments.

            – Adrian
            Nov 13 '18 at 7:23











          • I am going to read your link.

            – Adrian
            Nov 13 '18 at 7:24
















          Thank you for your answer. I know I can do it very well using JProfiler with a deployed agent inside the env. I am interested in some best practices. The ultimate solution is by doing experiments.

          – Adrian
          Nov 13 '18 at 7:23





          Thank you for your answer. I know I can do it very well using JProfiler with a deployed agent inside the env. I am interested in some best practices. The ultimate solution is by doing experiments.

          – Adrian
          Nov 13 '18 at 7:23













          I am going to read your link.

          – Adrian
          Nov 13 '18 at 7:24





          I am going to read your link.

          – Adrian
          Nov 13 '18 at 7:24

















          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%2f53265179%2fconfiguration-of-the-xmx-flag%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







          Popular posts from this blog

          Use pre created SQLite database for Android project in kotlin

          Darth Vader #20

          Ondo