SMP 3.0: Analyze and adjust JVM heap memory
I have done some findings in the area of JVM memory analysis and adjustment that I wanted to share.
In the Agentry Server prior to SMP one had the option to adjust the JVM heap memory size of each Agentry Server by adjusting the corresponding parameters of the Agentry.ini file.
The parameters were:
Now on SMP 3.0 the Agentry Server(s) are using the same runtime as the SMP, and you can no longer set memory allocation in the Agentry.ini (as it no longer exist). And you cannot set it in the Management Cockpit either, eventhough you have the [Java-1] section in your Backend configuration part of your Application definition.
So how do you analyse and adjust the JVM heap memory of the SMP 3.0 ?
Please note that the SMP 3.0 is using the SAP Java runtime JVM.
Fortunately a simple Analyzer tool is included in the SMP installation.
The tool is located in <SMP_HOME>\sapjvm_8\bin\jconsole.exe
If you start the tool directly, it will display Java processes executing in your user, and you can connect directly. Normally you would have to start the SMP by Go.bat.
If your SMP server is running as a service it will normally be executing under a different user (smpServiceUser), and you will need to start jconsole a little differently.
Start the Task Manager, and determine the process ID of the java.exe process hosting your SMP platform.
In my case the SMP java.exe is executing under process ID 1632.
Now open a command prompt and navigate to the folder where jconsole is located.
Issue the command “jconsole <PID>”, where <PID> is the process ID of the SMP java process.
You will get this warning, but just click “Insecure connection”.
You are located directly on the host so I don’t see any problem in this.
You will now get an overview, and you can navigate to multiple tabs for various information.
On the “VM Summary” tab, you can find info of the current and maximum heap size, as well as all kinds of other info regarding the VM.
In Windows (if you have no other Java processes running) you can use this script (attached) to start the JConsole view:
cd /d %SMP_ROOT%\sapjvm_8\bin
for /f “tokens=2” %%i in (‘tasklist /nh /fi “imagename eq java.exe” ‘) do set PID=%%i
If your server is running out of heap memory (java.lang.OutOfMemoryError), you may want to increase the heap memory allocation on the SMP.
Startup parameters for the JVM is set in the file: <SMP_HOME>\Server\props.ini
Default memory parameters are:
-Xms1024m Initial Heap size
-Xmx2048m Max Heap size
-XX:PermSize=256M Initial memory allocation for permanent objects
-XX:MaxPermSize=512M Max memory allocation for permanent objects
By adjusting the value of Xmx you can change the max allowed memory allocation for the JVM.
It is good practice to set Xms to 50% of the Xmx value (as far as I know).
A restart of the SMP server is needed for the changes to take effect.
I hope this is helpfull.