Friday, September 30, 2016

Memory Management In SAP system

The memory management system assigns memory to a work process. Here are some of the various memory types:


  1. SAP Roll Area
  2. SAP Extended Memory
  3. Private Memory

To find out the order in which memory type is assigned, refer to Allocating Memory for User Contexts.
The area of a User Context that is directly accessible is now extended as needed, if the user context has expanded. 

Use
For dialog work processes, the data of the user context, including internal tables is located in this expanded area. You can therefore access all the data in the user context. Only the data types Extract and Export to Memory remain in the SAP Paging.
The roll area is used for the initial memory assigned to a user context, and (if available) for additional memory if the expanded memory is full.
The majority of the user context is stored in the extended memory. Page management of this memory as a stack is not taken from the operating system; rather it is performed directly from the SAP System. This extended memory is implemented as an unnamed mapped file (on AIX and optionally on HP-UX as shared memory). This means the address space uses the paging file or uses the swap space of the operating system as background memory. For more information, please see the platform-specific documentation.
With the context change, the user context is not copied as with the roll area. Instead it is assigned to alternating work processes by mapping operations. The roll area can be decreased, which results in a faster context change because less data is copied and mapping an extended area is not work-intensive.
All internal tables and ABAP variables are located completely in the area of a user context that can be directly addressed. Copying and in/output operations when accessing internal tables and lists is no longer needed. The result is low CPU usage and shorter access times.

 SAP Roll Area 

The roll area is a memory area with a set (configurable) size that belongs to a work process. It is located in the heap of the virtual address space of the work process.
Use
When the context of a work process changes, the data is copied from the roll area to a common resource called theroll file. To prevent repeated copying, another roll buffer is located in between that is part of the shared memory.
Structure
The roll area consists of 2 segments. The first segment, which can be set with the parameter ztta/roll_first, is assigned to the work process first as memory. If this is used up, the work process has more memory assigned to it. The amount of memory is determined by the difference between the parameters ztta/roll_area and ztta/roll_first.

SAP Extended Memory 

SAP extended memory is the core of the SAP memory management system. Each SAP work process has a part reserved in its virtual address space for extended memory (see Virtual Address Space in a Work Process). You can set the size of extended memory using the profile parameter em/initial_size_MB: Extended Memory Pool Size.Under Windows, further memory is assigned dynamically as needed, and you can also set this amount.
Use
You can map the extended memory from the common resource onto any work process, and after onto another process (see graphic) on the same address in the virtual address space. This is important if you work with pointers in the ABAP program.
Structure
Depending on the operating system, how you implement the extended memory is different. Platform-Specific Description of Memory Management
The section Implementation explains the implementation for the different platforms in more detail. ztta/roll_first, is assigned to the work process first as memory. If this is used up, the work process has more memory as signed to it. The amount of memory is determined by the difference between the parameters ztta/roll_area and ztta/roll_first.

Private Memory 
Other processes cannot use private (heap) 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 (private) when the local memory is assigned. This 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. The mechanism is displayed again there.
See also:
Virtual Address Space of a Work Process
Use
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).
In the parameter settings, ensure that not too many dialog work processes are simultaneously in the PRIV mode, since this lowers system performance.
The other Work Process types (background, update, enqueue and spool work processes) are assigned heap memory after the roll area is used up. Allocating Extended Memory is not useful since no context change occurs for these processes.

No comments:

Post a Comment