Java – if I increase the memory heap, it will increase GC time

My current application runs on a normal GC cycle with 2GB of memory

I want to increase JVM memory to 4GB to improve application performance

Will it speed up GC time? If so, how much performance will be affected Is adjusting GC any good art for them?

Solution

Brief answer

Yes, time will increase Larger heap = longer pause time

The answer is long

There are several factors to consider How do you configure GC to run? How old is your younger generation? How often do you watch the full version of GC?

If you rarely see a full GC, the difference is negligible If you log GC activity, you can see that some GC pauses very quickly The difference between 2GB and 4GB on some GCS is about 0.1s To record GC activity, you can use the following parameter - XX: printgcdetails - verbose: GC - xloggc: / log / path / GC log. There are many tools that can read this GC log for you, providing charts and statistics, such as throughput and total pause time

If you often see full GC, which is why you need to add more memory, you may need to consider analyzing the application rather than looking at what is consuming all memory With a larger heap, these problems will only lead to longer GC until you solve the potential problem

Finally, you need to try various configurations, test correctly, and put the most suitable production environment into the production environment

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>