1) Stop WAS.

2) Reboot the server. If the system has been up for a long time it might not be possible to get a contiguous section of memory to allocate the large pages in. You will see this because if you run the sysctl command below it will fail to work. So it is recommended but not critical that the first step is to reboot the server.

3) Run the command:

echo 1536 >  / proc / sys / vm / nr_hugepages

Where 1536 denotes the number of 2MB large pages required, in this case 3GB worth. This setting will not be permanent so you will have to add this to the boot options for the server (/ etc / init.d / boot.local or equivalent).

4) Run more / proc / meminfo and check that it looks something like this at the bottom of the output:

HugePages_Total: 1536

HugePages_Free: 1536

Hugepagesize: 2048kB

5) As root update the / etc / sysctl.conf file to make sure that the shmmax is high enough for your new settings.Calculating the minimum size :

kernel.shmmax =(Xmx value) *1024*1024+ 100000000(add extra value that is about 95 MB)sample= 2048*1024*1024 + 100000000 =2247483648

But set it to at least:kernel.shmmax = 3221225472

6) As root run sysctl -p to load in that setting. You might need to do some investigation on making this setting permanent after a reboot.

7)For the two applications that I tested the most I could set the heap safely to was 2048 mb.

There is a possible 3GB available to a process on the 32 bit version of SuSE, 1 GB is reserved for the OS. This 3GB is split in two, one side for the java and native heap and one side for the executable itself. The boundary between these two sections is controlled by setting the mapped_base setting. If this setting is not modified then there is a limit on the size of the Java heap:

Size of area-space needed for native heap = available memory for Java heap

Modifying the boundary (mapped_base) it is possible to increase the area available. Changing mapped base to 52MB (0x3200000) -the default value is 1073741824- will allow a Java heap of 2048 mb and still leave enough space for native memory requirements of about 900MB. The 52MB has been shown to be enough for the Java executable to run in.

mapped base setting steps:

a) The mapped_base setting needs to be changed for the process that is going to spawn the Java process.

As root, place the following script in / sbin:

#!/ bin/ bash

echo 0x03200000 > / proc / $1 / mapped_base

In our environment this script was called wasadm_echo. You need to be root to be able to run this script and change the process’s mapped_base, the permission’s on this script are:

-rwxr-xr-x 1 root root

b) As root update the / etc / sysctl.conf file to make sure that the shmmax is high enough for your new settings. Set it to: kernel.shmmax = 3221225472

c) As root run sysctl -p to load in that setting. You might need to do some investigation on making this setting permanent after a reboot.

d) For a non-root user to be able to run the wasadm_echo script sudo needs to be configured. Run visudo and add the following line:

wasadm nwim0csmwas98=(ALL) NOPASSWD: / sbin / wasadm_echo

e) To make sure each process that starts up in WAS can have a larger heap, alter the setupCmdline.sh and add the following line: sudo / sbin / wasadm_echo $$

8) Modify your JVM arguments and add in the Xlp flag to make the JVM startup requesting large pages.If this is successful then inspecting / proc / meminfo will show something like:

HugePages_Total: 1536

HugePages_Free: 384

Hugepagesize: 2048kB

You should see an output of what mapped_base has been set to using “cat / proc / <pid> / mapped_base” command


We have found that in general bigger is better as far as the JVM heap size goes, but you should validate this. The recommended heap size to run with is 2048MB heap for both minimum and maximum. These heap sizes were only achievable after applying the latest version of the JDK to the WebSphere install. You need to be running at JDK release 1.4.2 SR3 or higher to achieve this.

Tests were done and 2.5GB was the maximum we were able to actually start tests at without the JVM crashing, but we received ‘malloc’ errors later on in some tests where JNI was heavily used so 2.5GB has been ruled out as too high a value due to the fact it starves the JVM of system heap.Also , 2304MB used to be the recommended setting as well but that value still caused native memory issues after a few days of running in production. If total value of  pmap -d <pid>is goes above 2.9 GB at any point then there is a chance of native memory exhaustion.To prevent this it might be required to do a weekly restart, thus maintaining a balance between optimum performance due a larger heap and stability of the system. Otherwise it might necessary to drop the heap size even further.


GeBI P2G WebSphere Portal 5.1 Performance Recommendations Document

The Journal of AUUG Inc. Volume 24 Number 3

Yorum yapın?