将max和min JVM堆大小设置为相同是否合适? [英] Is it good to set the max and min JVM heap size the same?

查看:170
本文介绍了将max和min JVM堆大小设置为相同是否合适?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前在我们的测试环境中,max和min JVM堆大小设置为相同的值,基本上与专用服务器机器允许我们的应用程序一样多。这是性能的最佳配置还是让JVM的范围更好?

Currently in our testing environment the max and min JVM heap size are set to the same value, basically as much as the dedicated server machine will allow for our application. Is this the best configuration for performance or would giving the JVM a range be better?

推荐答案

设置-Xms的主要原因是因为如果你在启动时需要一个堆。 (防止在启动时发生OutOfMemoryErrors。)如上所述,如果您需要启动堆以匹配最大堆,那么您将匹配它。否则你真的不需要它。只是要求应用程序占用它可能最终需要的更多内存。在负载测试和使用应用程序的同时观察内存使用情况(分析)应该会让您对将其设置为需要的内容有一个良好的感觉。但是在启动时将它们设置为相同并不是更糟糕的事情。对于我们的很多应用程序,我实际上从最初(启动)的128,256或512和最大的一千兆字节(这是非应用程序服务器应用程序)开始。

Main reason to set the -Xms is for if you need a certain heap on start up. (Prevents OutOfMemoryErrors from happening on start up.) As mentioned above, if you need the startup heap to match the max heap is when you would match it. Otherwise you don't really need it. Just asks the application to take up more memory that it may ultimately need. Watching your memory use over time (profiling) while load testing and using your application should give you a good feel for what to need to set them to. But it isn't the worse thing to set them to the same on start up. For a lot of our apps, I actually start out with something like 128, 256, or 512 for min (startup) and one gigabyte for max (this is for non application server applications).

刚刚发现这个关于堆栈溢出的问题也可能有帮助副作用换增加-MaxPermSize参数和 - 最大堆尺寸。值得一看。

Just found this question on stack overflow which may also be helpful side-effect-for-increasing-maxpermsize-and-max-heap-size. Worth the look.

这篇关于将max和min JVM堆大小设置为相同是否合适?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆