Enable Linux HugePages Oracle Weblogic
Before configuring the Linux HugePages, shut down all WebLogic Servers in the domain. Also stop the Administration Console instance and the Node Manager.
1. Log in as root user to the shell and execute the following commands to check the HugePages configuration:
[root@prod01]$ cat /proc/meminfo | grep Huge
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
Hugepagesize: 2048 kB
2. Create a mount point of type hugetlbfs:
[root@prod01]$ mkdir /mnt/hugepages
[root@prod01]$ chmod -R 777 /mnt/hugepages
[root@prod01]$ mount -t hugetlbfs nodev /mnt/hugepages
3. Add the following mount point to the /etc/fstab:
[root@prod01]$ vi /etc/fstab
4. Add the following line:
hugetlbfs /mnt/hugepages hugetlbfs rw,mode=0777 0 0
5. Enter :ws! to save the file and exit.
6. Edit the sysctl.conf file under /etc/:
[root@prod01]$ vi /etc/sysctl.conf
7. Reserve 2048 HugePages by adding the following line:
vm.nr_hugepages = 2048
8. Enter :ws! to save the file and exit.
9. Execute the following command to make the changes effective:
[root@prod01]# sysctl -p
10. Verify the change:
[root@prod01]$ cat /proc/meminfo | grep Huge
HugePages_Total: 2048
HugePages_Free: 2048
HugePages_Rsvd: 0
Hugepagesize: 2048 kB
11. Restart the host if the HugePages could not be allocated.
12. Repeat the preceding steps on all machines in the MY_DOMAIN.
To enable the Managed Servers to make use of the HugePages follow below steps:
1. Access the Administration Console by pointing your web browser to
http://adminhost.domain.local:7001/console.
2. Click on the Lock & Edit button to start a new edit session.
3. Expand the Environment tree to the left and then click on Servers.
4. Click on the My_Server01 link and then click on the Server Start tab.
5. Add the following to the Arguments field and click on the Save button:
-XX:+UseLargePagesForHeap
6. Click on the Activate Changes button.
7. Restart My_Server01.
8. Do the same for rest of the managed servers.
To calculate how many pages, get the memory needed and divide by the page size. The formula is sum of JVM heaps / page size.
If the memory needed is 4 GB (4096 MB) and the page size is 2 MB (Hugepagesize is 2048 KB). The number of HugePages is 4096/2 = 2048. This 4 GB of reserved HugePages will be pre-allocated and cannot be used by other applications, even when the JVMs are not running, so be sure to do the sizing properly.
If you have the -Xverbose:gc,memory enabled, you can check if the JVM is using the HugePages properly in the STDOUT logfile.
[INFO ][memory ] Using 2MB pages for Java heap.
With the My_Server01 started, checking the /proc/meminfo should also reveal that HugePages are in use.
[wls@prod01]$ cat /proc/meminfo | grep Huge
HugePages_Total: 2048
HugePages_Free: 1024
HugePages_Rsvd: 0
Hugepagesize: 2048 kB
Advantages Of Using Huge Page:
Because of the larger page size, the page table will be smaller in size. With HugePages, a 10 GB heap size should use only 5120 page entries despite the 2621440 page entries present when using the default 4 KB page size. This minimizes the CPU cost and the page table memory usage. A performance boost in memory operations because the TLB cache works more efficiently, with more cache hits. The memory reserved for HugePages will never swap to disk. It forces a more controlled memory usage of the heap sizes.
In case of any ©Copyright or missing credits issue please check CopyRights page for faster resolutions.