此内容没有您所选择的语言版本。

Chapter 2. Java Virtual Machine settings


Java Virtual Machine tuning might be divided into sections like memory or GC. Below is a list of helpful configuration parameters and a guide how to adjust them.

2.1. Memory settings

Adjusting memory size is one of the most crucial step in Red Hat Data Grid tuning. The most commonly used JVM flags are:

  • -Xms - Defines the minimum heap size allowed.
  • -Xmx - Defines the maximum heap size allowed.
  • -Xmn - Defines the minimum and maximum value for the young generation.
  • -XX:NewRatio - Define the ratio between young and old generations. Should not be used if -Xmn is enabled.

Using Xms equal to Xmx will prevent JVM from dynamically sizing memory and might decrease GC pauses caused by resizing. It is a good practice to specify Xmn parameter. This guaranteed proper behavior during load peak (in such case Red Hat Data Grid generates lots of small, short living objects).

2.2. Garbage collection

The main goal is to minimize the amount of time when JVM is paused. Having said that, CMS is a suggested GC for Red Hat Data Grid applications.

The most frequently used JVM flags are:

  • -XX:MaxGCPauseMillis - Sets a target for the maximum GC pause time. Should be tuned to meet the SLA.
  • -XX:+UseConcMarkSweepGC - Enables usage of the CMS collector.
  • -XX:+CMSClassUnloadingEnabled - Allows class unloading when the CMS collector is enabled.
  • -XX:+UseParNewGC - Utilize a parallel collector for the young generation. This parameter minimizes pausing by using multiple collection threads in parallel.
  • -XX:+DisableExplicitGC - Prevent explicit garbage collections.
  • -XX:+UseG1GC - Turn on G1 Garbage Collector.

2.3. Other settings

There are two additional parameters which are suggested to be used:

  • -server - Enables server mode for the JVM.
  • -XX:+ UseLargePages - Instructs the JVM to allocate memory in Large Pages. These pages must be configured at the OS level for this parameter to function successfully.

2.4. Example configuration

In most of the cases we suggest using CMS. However when using the latest JVM, G1 might perform slightly better.

32GB JVM

-server
-Xmx32G
-Xms32G
-Xmn8G
-XX:+UseLargePages
-XX:+UseConcMarkSweepGC
-XX:+UseParNewGC
-XX:+DisableExplicitGC
Copy to Clipboard Toggle word wrap

32GB JVM with G1 Garbage Collector

-server
-Xmx32G
-Xms32G
-Xmn8G
-XX:+UseG1GC
Copy to Clipboard Toggle word wrap

Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2026 Red Hat
返回顶部