Visit our Google Group Way 2 SAP BASIS


Moderators: BASIS24x7, Rashed


Postby naveedahmed »

SAP Memory Types


The memory management system assigns memory to a work process. Here are some of the various memory types:
SAP Roll Area
SAP Extended Memory
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.
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.

The advantages of the memory management system require increased swap space and main memory. The need for swap space increases because full-sized internal tables and lists are in the address space and take up swap space. The main memory requirements may increase to prevent excessive operating system paging due to the increased swap space requirements.

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.
When the context of a work process changes, the data is copied from the roll area to a common resource called 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. 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.
For more detailed information, please see the platform-specific section under Implementation.
For technical reasons, the roll area is always the first memory that receives a work process. Only afterwards can extended memory be requested.
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.
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.

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.
The SAP system builds a layer on to the operating system functions for the page management of this memory. This 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.
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
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.
Automatic Termination of PRIV Mode Processes
If too many dialog work processes run in the PRIV mode in an SAP application server, performance problems arise. The normal processing of user inquiries is slowed down by the PRIV mode work processes.
The SAP System offers a mechanism that lets you terminate non-active dialog processes in the PRIV mode. This mechanism helps reduce performance problems.
The mechanism works as follows:
In the PRIV mode, a maximum number (n) of dialog work processes can run without any time restrictions.
To determine this number n, set the value of the profile parameter rdisp/wppriv_max_no. If a value is not entered, the SAP System determines this number using the following formula:
the number (n) is set to the greater of the 2 following values:
• Number of dialog work processes minus 5
• 1
If more than (n) dialog work processes are active and the time span set in parameter rdisp/max_priv_time (default 600 seconds) has elapsed, the transaction for that PRIV process, which has spent the longest possible time in PRIV mode, is reset.

You have configured 10 dialog work processes on one SAP instance. The parameters rdisp/wppriv_max_no and rdisp/max_priv_time are not changed (default settings).
Then, the SAP System checks periodically if more than 5 dialog work processes are in PRIV mode after 600 seconds (10 minutes). If this is the case, the transaction is reset that has been in PRIV mode for the longest time. A corresponding dialog box appears to the user.
If performance problems arise, you can change these parameters, but do this only after consulting with SAP.

Non-dialog work processes (background, update, etc.) are not contained in this mechanism and are also not considered.

Memory Use
Memory Use Overview
If you choose Goto  Status Display  Memory Use, a tab appears allowing you to display the following:
• Memory Use – Total
• Memory Use – Ranking List
• Memory Use – SCC (strongly connected components)

The Memory Analysis not only allows you to display the memory use in the Debugger by choosing Memory Use, but you can also save memory snapshots and analyze them using the Memory Inspector.

Memory Use Displays
• Memory Use – Total
The memory use of the following memory areas is displayed in bytes (see Virtual Address Space of a Work Process):
• Heap memory (private memory)
• Roll Memory
• Used memory (that is, the memory occupied by data in the roll or heap memory
• Allocated memory (that is, the memory requested in the roll or heap memory
• Short memory (memory for storing interim results – for example, from the screen that is automatically cleared after each dialog step)

• Paging Memory
• Memory Use – Ranking List
Displays a list that contains all used data objects, sorted by bound memory, and is updated automatically.
• Memory Use – SCC
All dynamic objects (internal tables, strings, objects created using CREATE OBJECT, anonymous data objects created using CREATE DATA) of an internal session make up the nodes of a directed graph whose edges are the corresponding references. To analyze the graph you must be familiar with the strongly connected components (SCC). An SCC is characterized by the following: For two elements A and B of an SCC, one path exists in the object graph from A to B and one from B to A. The path always consists of several connected edges.

The system displays a ranking list of the memory use of all SCCs in the current internal session; the entries are sorted either by referenced or by bound memory. The list only includes SCCs that consist of at least two elements.
Significance of Columns for Individual Display, Ranking List, and SCCs
• Bound Memory
Memory that that is freed up when a complete deletion takes place (for internal tables, with FREE).
• Referenced Memory
Memory referenced by the data object (possibly skipping other data objects). This memory is not necessarily released when the data object is deleted, since other data objects may still be referencing the memory. The referenced memory is always larger than or equal to the bound memory.
• Used Memory
Memory occupied by user data.
• Allocated Memory
Memory reserved by the system. The allocated memory is always larger than or equal to the used memory.
• Number of Instances
This column appears in ranking lists only after a grouping and for SCCs. It specifies that number of instances of a class, a data type, or the elements of an SCC.
• Sharing
This column only concerns internal tables and strings. It is selected if sharing is active for the internal tables or strings after assignments.
• SCC Selection
If an internal table, an object, or an anonymous data object is part of an SCC, a button appears in the right of the column, choosing this button displays the relevant SCC.
Additional Functions for Ranking Lists and SCCs
• Settings
If you choose Change Settings, the system displays a window, in which you can specify the sorting order (by bound or referenced memory), the update procedure (automatic or manual), and the number of entries. For the memory use ranking list, you can also specify the type of data objects whose memory use is to be displayed. In the ranking list, you can also group objects and anonymous data objects (created using CREATE DATA) according to their classes or data types. The system adds the memory requirement of the individual objects and the static memory. This function is useful if a class or data type has many instances that each have small requirements.
• Instance List
This function is available for ranking lists only after a grouping. If you choose the Instance List icon, the system displays all instances of a class, a data type, or all elements of an SCC.
• Find References
If you choose the Find References icon, the system lists all references to an object, anonymous data object, string, internal table, or SCC.
In the case of strings and internal tables for which sharing is active after assignments, the system displays all variables that are used to address the common data area. This also includes variables of other ABAP programs in the same internal session that access strings and internal tables declared using DATA ... COMMON PART.
• Save as Local File
This function is only available for ranking lists. You can use it to save an excerpt of the ranking list in a local file on the presentation server in Excel format

Memory Display for Single Objects and Data Objects
You can activate and deactivate the memory display for individual objects and data objects by choosing Settings  Memory Display On/Off. The current memory values are shown in the display for the individual objects or data objects.
If you choose the Find References icon, the system displays all references to an object, anonymous data object, string, or internal table.
If an internal table, an object, or an anonymous data object is part of an SCC, a button appears in the right of the column: choosing this button displays the relevant SCC.

Sharing is possible for internal tables and strings. The sharing is displayed in the system by a reference counter. If this counter has the value 1, sharing is not active for the internal table or string. In this case, the memory use is added to the node that references this internal table string – that is, the size of the internal table or string is contained in the bound memory of the higher-level node.

Posts: 56

Return to CCMS Forum

Who is online

Users browsing this forum: No registered users and 1 guest

Visit our Google Group Way 2 SAP BASIS