SAP Memory Management
Many times SAP customers face performance issues and there are requirements to tune SAP systems. It becomes very important to set the SAP memory parameters to optimum values in order to make any SAP server perform good. Even more important is to understand the concept of memory management in the SAP Web Application Server before making any changes to the parameters.
So let’s quickly check out some of the memory management concepts in the ABAP stack. The SAP memory management system assigns memory to a work processes. There are following types of memories in SAP:
- Roll Memory
- Extended Memory
- Private Memory
1. Roll Memory
The initial memory assigned to a user context is the roll memory and it is again assigned in case the once the expanded memory is full. The roll area is a memory area with a configurable size that belongs to a work process and it is located in the heap of the virtual address space of the work process.
When the context of a work process changes, the data is copied from the roll area to the roll file. To prevent repeated copying, another roll buffer is located in between that is part of the shared memory.
The roll area consists of 2 segments:
ztta/roll_first – is assigned to the work process first as memory
ztta/roll_area – If ztta/rool_first is used up the difference between ztta/roll_area and ztta/roll_first is assigned to the work process
2. Extended Memory
SAP work process has a part reserved in its virtual address space for extended memory. This can be set using the size of extended memory using the profile parameter em/initial_size_MB: Extended Memory Pool Size.
Extended memory from the common resource onto any work process can be mapped, and after onto another process on the same address in the virtual address space. Since it varies with operating system and hence it can be implemented as per requirement.
In case of windows it is automatically managed.The SAP system builds a layer on to the operating system functions for the page management of this memory. The extended memory is implemented as an unnamed mapped file. This means the address space uses the paging file or uses the swap space of the operating system as background memory.
3. Private Memory
If a dialog work process has used up the roll area assigned to it and the extended memory, private memory is assigned to the work process. The work process goes into PRIV mode (private).
This memory is dedicated to a process thus a work process can run in PRIV mode also called the private mode when the local memory is exhausted. Other processes cannot use private memory.
After releasing the assigned memory, the operating system still considers the virtual memory as being occupied by the allocating process.
These characteristics of heap memory require that:
1. The work process can be run in PRIV mode when the local memory is assigned and it means that the work process is reserved for processing the current user context until the context releases the work process again when the request has ended.
2. The work process, if it has used a lot of private memory, is restarted when the user context is terminated and the local memory is returned. The restart makes the local memory available again for other processes. A restart occurs if a work process uses more local memory than is defined in the parameter abap/heaplimit.
In case too many work processes go into PRIV mode, it might cause severe performance problems in the system.
The profile parameter rdisp/wppriv_max_no defines that in the PRIV mode, a maximum number (n) of dialog work processes can run without any time restrictions