简体   繁体   English

JVM应该设置多少内存

[英]How much memory should be set to JVM

How much memory should be configured to use if I want to utilize all server ram.如果我想利用所有服务器内存,应该配置多少内存。

For example, if servers has 32Gb ram, which settings should be set via Xmx?例如,如果服务器有 32Gb ram,应该通过 Xmx 设置哪些设置? 32Gb-10%? 32Gb-10%? or 30Gb-4Gb?还是 30Gb-4Gb? Any other heuristic?还有其他启发式方法吗?

First step is to understand how much of your memory is really free.第一步是了解您有多少内存是真正空闲的。

1) How much does your OS take? 1) 你的操作系统需要多少钱? (consider also some space for OS caches) (还要考虑一些用于操作系统缓存的空间)

2) Are there any other apps running which might use significant amount of memory? 2) 是否有其他应用程序正在运行,可能会占用大量内存? (DB, etc.) How much do they usually take? (DB 等)他们通常需要多少钱?

3) What kind of IO does your app do? 3)你的应用程序做了什么样的IO? Hard drive?硬盘? Network?网络? Both will benefit from some free memory.两者都将受益于一些空闲内存。

If I were you I would start around (if there aren't any other apps) 24 GB.如果我是你,我会开始使用(如果没有任何其他应用程序)24 GB。 Then run some stress test and monitor memory utilization and fix your setting based on this observation.然后运行一些压力测试并监控内存利用率并根据此观察修复您的设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM