Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.

3.2. Configure Page Memory


Page memory configuration to optimize Red Hat JBoss Data Grid's performance must be implement at the operating system level and at the JVM level. The provided instructions are for the Red Hat Enterprise Linux operating system. Use both the operating system level and JVM level instructions for optimal performance.

Procedure 3.1. Configure Page Memory for Red Hat Enterprise Linux

  1. Set the Shared Memory Segment Size

    As root, set the maximum size of a shared memory segment in bytes; below we define this to be 32 GB:
    # echo "kernel.shmmax = 34359738368" >> /etc/sysctl.conf
  2. Set the Huge Pages

    The number of huge pages is set to the total amount of memory the JVM will consume (heap, meta space, thread stacks, native code) divided by the Hugepagesize. In Red Hat Enterprise Linux systems Hugepagesize is set to 2048 MB.
    1. The number of huge pages required can be determined by the following formula:
      Heap + Meta space + Native JVM Memory + (Number of Threads * Thread Stack Size)
    2. Assuming a JVM with a 32 GB Heap, 2 GB of Meta space, a 512 MB native footprint, and 500 threads, each with a default size of 1 MB per thread, we have the following equation.
      32*(1024*1024*1024) + 2*(1024*1024*1024) + 512*(1024*1024) + (500 * 1024*1024)
    3. The resulting value can now be converted to hugepages. Since there are 2048 MB in a single hugepage we perform the following:
      37568380928 / (2*1024*1024)
    As root, set the number of huge pages determined from the previous steps to be allocated to the operating system:
    # echo "vm.nr_hugepages = 17914" >> /etc/sysctl.conf
  3. Assign Shared Memory Segment Permissions

    As root, set the ID of the user group that is allowed to create shared memory segments using the hugetlb_shm_group file. This value should match the group id of the user running the JVM:
    # echo "vm.hugetlb_shm_group = 500" >> /etc/sysctl.conf
  4. Update the Resource Limits

    To allow a user to lock the required amount of memory, update the resource limits in the /etc/security/limits.conf file by adding the following:
    jboss      soft   memlock      unlimited
    jboss      hard   memlock      unlimited
    This change allows the user jboss to lock the system's available memory.
  5. Configure Authentication using PAM

    Linux's PAM handles authentication for applications and services. Ensure that the configured system resource limits apply when using su and sudo as follows:
    1. Configure PAM for su

      Add the following line to the /etc/pam.d/su file:
      session    required   pam_limits.so
    2. Configure PAM for sudo

      Add the following line to the /etc/pam.d/sudo file:
      session    required   pam_limits.so
  6. Reboot the system for the changes to take effect. Since Huge Pages allocate a contiguous block of memory these must be allocated at system boot; attempts to claim these dynamically while the system is running may result in system hangs if the memory is unable to be reclaimed.

Procedure 3.2. Configure Page Memory for the JVM

  1. Set the Heap Size

    Use the -Xms and -Xmx parameters to set the minumum and maximum heap sizes for your JVM, as discussed in Chapter 2, Java Virtual Machine Settings.
  2. Enable Large Pages

    Enabled large pages for the JVM by adding the following parameter, as discussed in Chapter 2, Java Virtual Machine Settings:
    -XX:+UseLargePages
Red Hat logoGithubredditYoutubeTwitter

Lernen

Testen, kaufen und verkaufen

Communitys

Über Red Hat Dokumentation

Wir helfen Red Hat Benutzern, mit unseren Produkten und Diensten innovativ zu sein und ihre Ziele zu erreichen – mit Inhalten, denen sie vertrauen können. Entdecken Sie unsere neuesten Updates.

Mehr Inklusion in Open Source

Red Hat hat sich verpflichtet, problematische Sprache in unserem Code, unserer Dokumentation und unseren Web-Eigenschaften zu ersetzen. Weitere Einzelheiten finden Sie in Red Hat Blog.

Über Red Hat

Wir liefern gehärtete Lösungen, die es Unternehmen leichter machen, plattform- und umgebungsübergreifend zu arbeiten, vom zentralen Rechenzentrum bis zum Netzwerkrand.

Theme

© 2026 Red Hat
Nach oben