Work Process Memory Analysis+on+Linux+and+Solaris
Work Process Memory Analysis+on+Linux+and+Solaris
com/wiki/display/SI/Analysis+on+Linux+and+Solaris
Community WIKI SAP Community Welcome, Guest Login Register Search the Community
Application Server Infrastructure / … / Analyzing the heap memory usage of an ABAP work process
As mentioned in the main page of this WIKI, using the "ps" command to analyze heap memory usage is not helpful because "ps -elf" can (and most
likely will) include the shared memory areas used by the work process. This can happen in both Linux and Solaris.
The appropriate tool for heap memory analysis would be "pmap".
You can execute "pmap <PID of SAP work process>" and look for "heap" and "anon" blocks. Depending on the OS, pmap will also provide a
summary at the end of its output.
Using a test system (running on Linux) to simulate a heap memory issue, the following outputs were collected before the issue was triggered:
If "egrep" is available at the OS in use, you can use it (as it is shown above) in order to have a filtered output from pmap, showing only the relevant
lines (header line, all "heap" and "anon" blocks, and the summary line from the end).
The summary line (highlighted in bold) shows that this work process (the work process itself) is using around 380MB of memory: around 155MB of
heap (private) writable memory plus around 225MB of heap readonly memory. The latter would be the executable itself (the "disp+work" binary file)
1 of 4 01/03/2019, 20:53
Analysis on Linux and Solaris - Application Server Infrastructure - SCN... https://wiki.scn.sap.com/wiki/display/SI/Analysis+on+Linux+and+Solaris
Notice that the "ps" output does not change significantly (because it shows usage of 4KB blocks), but it still shows much more memory than the work
process itself is using (it is still including the shared memory areas).
At the "pmap" output, we can see a new "anon" segment of about 150MB. We also see that the writable heap memory area has increased (at the
summary line).
The corresponding work process was idle during the time all the commands above were collected.
In order to determine whether the incorrect memory usage was triggered within the SAP kernel, we can use the transaction SM50, menu path
Administration -> Work process -> Write stack (prerequisite: the SAP kernel in use must be 742 patch level 315 / 745 patch level 35, or higher).
Then, the corresponding trace file (dev_w8, in this case) will have the following information:
2 of 4 01/03/2019, 20:53
Analysis on Linux and Solaris - Application Server Infrastructure - SCN... https://wiki.scn.sap.com/wiki/display/SI/Analysis+on+Linux+and+Solaris
3 of 4 01/03/2019, 20:53
Analysis on Linux and Solaris - Application Server Infrastructure - SCN... https://wiki.scn.sap.com/wiki/display/SI/Analysis+on+Linux+and+Solaris
We can see that the "FCLASS" tag is allocating exactly the 150MB of memory that should not be there.
Thus, we should search for SAP notes that would address a memory issue ("memory leak") related to the "FCLASS" tag.
Notice that:
"FCLASS" was a tag name used for the example above. It may not exist;
This was a straightforward example, when one tag made only one allocation that matched the issue exactly. It is possible that the memory leak
would occur over several small allocations instead of a single large allocation.
If the information at the trace file does not indicate that any of the tags is causing the issue, then you should continue with the analysis from different
areas, like the OS libraries and the database client / libraries.
<back to main page>
No labels
4 of 4 01/03/2019, 20:53