1. <i id='xQsjZ'><tr id='xQsjZ'><dt id='xQsjZ'><q id='xQsjZ'><span id='xQsjZ'><b id='xQsjZ'><form id='xQsjZ'><ins id='xQsjZ'></ins><ul id='xQsjZ'></ul><sub id='xQsjZ'></sub></form><legend id='xQsjZ'></legend><bdo id='xQsjZ'><pre id='xQsjZ'><center id='xQsjZ'></center></pre></bdo></b><th id='xQsjZ'></th></span></q></dt></tr></i><div id='xQsjZ'><tfoot id='xQsjZ'></tfoot><dl id='xQsjZ'><fieldset id='xQsjZ'></fieldset></dl></div>

    <small id='xQsjZ'></small><noframes id='xQsjZ'>

      <tfoot id='xQsjZ'></tfoot>

        <bdo id='xQsjZ'></bdo><ul id='xQsjZ'></ul>
      <legend id='xQsjZ'><style id='xQsjZ'><dir id='xQsjZ'><q id='xQsjZ'></q></dir></style></legend>
    1. 为高响应服务器应用程序调整 JVM (GC)

      时间:2023-07-12
      • <tfoot id='j1u9N'></tfoot><legend id='j1u9N'><style id='j1u9N'><dir id='j1u9N'><q id='j1u9N'></q></dir></style></legend>

              <small id='j1u9N'></small><noframes id='j1u9N'>

              <i id='j1u9N'><tr id='j1u9N'><dt id='j1u9N'><q id='j1u9N'><span id='j1u9N'><b id='j1u9N'><form id='j1u9N'><ins id='j1u9N'></ins><ul id='j1u9N'></ul><sub id='j1u9N'></sub></form><legend id='j1u9N'></legend><bdo id='j1u9N'><pre id='j1u9N'><center id='j1u9N'></center></pre></bdo></b><th id='j1u9N'></th></span></q></dt></tr></i><div id='j1u9N'><tfoot id='j1u9N'></tfoot><dl id='j1u9N'><fieldset id='j1u9N'></fieldset></dl></div>
                <tbody id='j1u9N'></tbody>
              • <bdo id='j1u9N'></bdo><ul id='j1u9N'></ul>
                本文介绍了为高响应服务器应用程序调整 JVM (GC)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我在 64 位 Linux 上运行一个应用服务器,它有 8 个核心 CPU 和 6 GB 内存.

                I am running an application server on Linux 64bit with 8 core CPUs and 6 GB memory.

                服务器必须高度响应.

                经过一番检查,我发现在服务器上运行的应用程序创建了相当大量的短期对象,并且只有大约 200~400 MB 的长期对象(只要没有内存泄漏)

                After some inspection I found that the application running on the server creates rather a huge amount of short-lived objects, and has only about 200~400 MB long-lived objects(as long as there is no memory leak)

                看完http://java.sun.com/javase/技术/热点/gc/gc_tuning_6.html我使用这些 JVM 选项

                After reading http://java.sun.com/javase/technologies/hotspot/gc/gc_tuning_6.html I use these JVM options

                -server -Xms2g -Xmx2g -XX:MaxPermSize=256m -XX:NewRatio=1 -XX:+UseConcMarkSweepGC
                

                结果:minor GC 需要 0.01 ~ 0.02 sec,major GC 需要 1 ~ 3 sec次要 GC 不断发生.

                Result: the minor GC takes 0.01 ~ 0.02 sec, the major GC takes 1 ~ 3 sec the minor GC happens constantly.

                如何进一步改进或调整 JVM?

                How can I further improve or tune the JVM?

                更大的堆大小?但是GC会需要更多时间吗?

                larger heap size? but will it take more time for GC?

                更大的 NewSize 和 MaxNewSize(针对年轻一代)?

                larger NewSize and MaxNewSize (for young generation)?

                其他收藏家?并行GC?

                other collector? parallel GC?

                让major GC更频繁地发生是个好主意吗?以及如何?

                is it a good idea to let major GC take place more often? and how?

                推荐答案

                结果:minor GC 需要 0.01 ~ 0.02 sec,major GC 需要 1 ~ 3 sec,minor GC 不断发生.

                Result: the minor GC takes 0.01 ~ 0.02 sec, the major GC takes 1 ~ 3 sec the minor GC happens constantly.

                除非您报告暂停,否则我会说 CMS 收集器正在执行您要求它执行的操作.根据定义,CMS 将使用比串行和并行收集器更大百分比的 CPU.这是您为低暂停时间付出的代价.

                Unless you are reporting pauses, I would say that the CMS collector is doing what you have asked it to do. By definition, CMS will use a larger percentage of the CPU than the Serial and Parallel collectors. This is the penalty you pay for low pause times.

                如果您看到 1 到 3 秒 暂停 次,我会说您需要进行一些调整.我不是专家,但看起来您应该从默认值 92 减少 CMSInitiatingOccupancyFraction 的值开始.

                If you are seeing 1 to 3 second pause times, I'd say that you need to do some tuning. I'm no expert, but it looks like you should start by reducing the value of CMSInitiatingOccupancyFraction from the default value of 92.

                增加堆大小将提高 GC 的吞吐量".但如果您的问题是长时间停顿,那么增加堆大小可能会使问题变得更糟.

                Increasing the heap size will improve the "throughput" of the GC. But if your problem is long pauses, increasing the heap size is likely to make the problem worse.

                这篇关于为高响应服务器应用程序调整 JVM (GC)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:如何在java中销毁一个对象? 下一篇:有人能理解 G1 垃圾收集器的输出吗?

                相关文章

                1. <small id='Lridp'></small><noframes id='Lridp'>

                  • <bdo id='Lridp'></bdo><ul id='Lridp'></ul>
                    <tfoot id='Lridp'></tfoot>

                    <i id='Lridp'><tr id='Lridp'><dt id='Lridp'><q id='Lridp'><span id='Lridp'><b id='Lridp'><form id='Lridp'><ins id='Lridp'></ins><ul id='Lridp'></ul><sub id='Lridp'></sub></form><legend id='Lridp'></legend><bdo id='Lridp'><pre id='Lridp'><center id='Lridp'></center></pre></bdo></b><th id='Lridp'></th></span></q></dt></tr></i><div id='Lridp'><tfoot id='Lridp'></tfoot><dl id='Lridp'><fieldset id='Lridp'></fieldset></dl></div>

                    <legend id='Lridp'><style id='Lridp'><dir id='Lridp'><q id='Lridp'></q></dir></style></legend>