SAP Memory Management
SAP Memory Management
SAP Memory Management
In SAP the memory management system assigns memory to a work process. Each Work Process has its own local memory to
perform functions. It contain ABAP Executable, Buffer for Database Transfer, Local Roll area. To optimize the performance of
SAP Systems , it is necessary to understand Memory Management in SAP
Definition of Virtual Memory: When system memory runs low, Application uses space allocated from the hard disk drive to
act as RAM. This is the "virtual memory." The maximum amount of allocated space is usually equal to half the amount of RAM
installed. This gives the computer 50 percent more memory to run applications.
Maximum virtual memory >= physical memory + operating system swap space
Definition of Shared Memory: If several processes are to access the same memory area, both allocation steps are not
transparent. One object is created that represents the physical memory and can be used by various processes. The processes
can map the object fully or partially into the address space. The way this is done varies from platform to platform. Memory
mapped files, unnamed mapped files, and shared memory are used.
R/3 Buffer:
R/3 Buffer is the part of Extended Memory. It is accessible to all the work process of same application server. R/3 Buffer
contains global objects such as Programs, Customizing Tables, etc. Following are the Parameters for the same:
abap/heap_area_dia : Defines the limit for the amount of local memory allocated to dailog work processes.
abap/heap_area_nondia: Defines the limit for the amount of local memory allocated to nondialog work processes.
abap/heap_area_total: Defines the limit for the total amount of heap memory allocated to all work processes.
1/16
Extended Memory:
Extended Memory also comes under Shared Memory. It maintains 1:n relation with work processes. Extended Memory
contains User Context Data. Following are the Parameters for the same:
ztta/roll_extension: Defines the user quota for extended memory
em/initial_size_MB: Defines the fixed size of extended memory
2/16
Heap Memory:
When your Extended Memory is full, Work Process start using Heap Memory i.e., 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.
The SAP system offers a mechanism that let you terminate nonactive dialog processes in the PRIV mode. This mechanism
helps reduce performance problems.
abap/heaplimit This value specifies the memory amount in bytes. When this amount is exceeded, a work process is restarted
after executing a dialog step.
Roll Memory:
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.
Following are the Parameters for the same:
ztta/roll_first: Defines the first part of the roll area that is allocated to a dialog process
ztta/roll_area: Defines the total roll area per work process
3/16
zdisp/roll_SHM: Defines the size of the roll buffer.
rdisp/roll_MAXFS: Defines the size of roll buffer and roll file.
ztta/roll_extension: Defines the user quota for extended memory
Paging Memory:
R/3 Paging Memory contains ABAP Objects Extracts and Exports. Following are the parameters for the same
rdisp/PG_SHM: Paging Buffer Size
rdisp/PG_MAXFS: Maximum Size of the SAP Paging File
4/16
Here the below find the complete picture of R/3 Memory System point of View.
R/3 memory Allocation
User Context Data:
5/16
In an R/3 System, many frontend users are connected to one are more application servers. The work that users request from
the system is performed in work processes. Normally, there are fewer work processes than frontend users.
A work process is dedicated to a frontend user only while a specific dialog step is being processed by the application server. A
user can be dispatched to one work process in one dialog step, and to another work process in the following dialog step. Over
the course of time, users are dispatched to different work processes.
In the course of thier work in dialog work processes, users accumulate various pieces of data, such as pointers to programs they
are using. This accumulated data is called the "user context". A user context enables, for example, the material number you are
working on to be remembered by the system and proposed as the default in a following transaction.
6/16
The mechanism known as a "roll out" ensures that when user 2 needs to use the work process which has just been used by
user 1, the user context data of user 1 is not be lost or overwritten.
The roll out saves the user context data for the dialog user when he or she exits the work process.
7/16
Work process 1 is occupied by another user. When user 1, who was formerly working in work process 1, is therefore dispatched
to work process 2, the user context data is copied into work process 2 by the mechanism known as a "roll in". User 1 can thus
continue from where he or she stopped in the earlier work process.
1. The data processed in work processes is stored in two memory areas:
8/16
Ÿ The roll area, in which user context data is stored. User context data may include pointers to active programs, set/get
parameters (related to the most recent input of the user), authorizations, internal tables, and report lists.
Ÿ The paging area, which stores the application program data that correspond to specific ABAP commands including
EXTRACT, IMPORT TO MEMORY, EXPORT FROM MEMORY, and CALL TRANSACTION.
2. The size of these areas is configurable using R/3 profile parameters.
1. Where there is buffer space available, the roll area and the paging area are held in the respective buffers in the
application servers. When there is not sufficient buffer space, the roll area and the paging area must be stored in the
respective physical disk files (roll file and paging file).
2. Thus, the user data processed in work processes is stored in two areas:
The roll file and its associated buffer
Ÿ The page file and its associated buffer
User contexts are not only stored in roll files and the corresponding buffers. As of R/3 Release 3.0, they are primarily
stored in R/3 extended memory.
In R/3 extended memory, a large area of memory shared by all available work processes can be accessed through
pointers. Using extended memory as well as roll files thus reduces the amount of copying from roll areas that is required
9/16
during user context switches, and avoids the overhead caused by large rollin or rollout tasks.
Note :
1. In R/3 memory management:
Work processes serve a large number of frontend users
Each work process must be capable of loading the user context data for successive frontend users
2. The roll data and paging data is copied to the roll buffer and paging buffer and the corresponding files when a user leaves
the work process.
3. R/3 extended memory uses mapping instead of copying and therefore allows:
Fast access to internal tables and lists through pointers
Quick context switches
Usage of hardware with large memory
Reduced load on CPU and disk
4. R/3 extended memory requires sufficient physical memory
Allocation sequence for dialog work processes
To keep the usage of the roll area to a minimum and make more use of extended memory, only a small portion of the roll
area is used initially. The size of this portion is set by the parameter ztta/roll_first.
Note: Independent of parameter ztta/roll_first, there is a minimum amount of roll area that is always used. For example,
if ztta/roll_first is set to 1, not just one byte is allocated, but the minimum amount required for administrative data.
10/16
Extended memory enables the data to be stored in your system, where it is efficiently accessed by pointers rather than by a copy
process.
The extended memory per user may vary from 1 MB to several 100 MB.
The user quota defines the maximum amount of R/3 extended memory that can be used by any one user, and is set with
the parameter ztta/roll_extension.
11/16
The user quota thus prevents one user from occupying all available extended memory.
The remaining portion of R/3 roll memory is used when the system can no longer allocate R/3 extended memory, either
because R/3 extended memory is full or because the quota has been reached.
The reason for using the remaining portion of R/3 roll memory is to avoid using heap memory, which is local memory,
and avoid entering PRIV mode (see below).
If the work process requires still more space after using up all available roll area and extended memory, the system is
forced to allocate R/3 heap memory locally.
12/16
Heap memory allocated by one work process is not
accessible to any other work process. This means that
a user is unable to continue the transaction in a
different work process.
The user is now effectively locked to the work process.
This situation is called PRIV mode.
A dialog process that was forced to allocate R/3 heap
memory automatically enters PRIV mode.
While a user is in a transaction which caused the
work processes to enter PRIV mode, no other user can access the work process.
Since R/3 architecture uses a limited number of work processes to satisfy a larger number of frontend users, other users
suffer when a user goes into PRIV mode.
If several users go into PRIV mode, they can work well, but other users can hardly work at all.
13/16
Data in R/3 roll memory is copied during context
switch.
Data in R/3 extended memory is mapped during
context switch.
Data in R/3 heap memory can never leave the work
process. If heap memory is allocated, the work process is exclusively assigned to one user in PRIV mode.
Note: the sequence in which memory is used by work processes is not determined by the amount memory initially
allocated. Thus, while the entire roll memory is allocated on work process start, it is not initially used up completely.
Allocation Sequence for Dialog WPs Summary
The memory allocation strategy for dialog work processes aims to prevent work processes from allocating R/3
heap memory and thus entering PRIV mode.
When a work process enters PRIV mode, it remains connected to the user until the user ends the transaction.
Allocation sequence for nondialog work processes
14/16
Data in R/3
roll memory
is copied during context switch.
Data in R/3 extended memory is mapped during context switch.
Data in R/3 heap memory can never leave the work process. If heap memory is allocated, the work process is exclusively
assigned to one user in PRIV mode.
Note: the sequence in which memory is used by work processes is not determined by the amount memory initially allocated.
Thus, while the entire roll memory is allocated on work process start, it is not initially used up completely.
15/16
Random access memory (RAM) is physical memory that holds the applications, documents and procedures on a
computer. Virtual memory is a storage area that holds the files on your hard drive for retrieval when a computer runs out of
RAM
Physical Memory: Physical memory is the RAM chips purchased and placed in a slot on the computer motherboard. The
RAM is the first memory used when the computer requires memory usage, such as for loading an application or opening a
document.
Virtual Memory: Virtual memory is stored on the hard drive. Virtual memory is used when the RAM is filled. Virtual
memory is slower than physical memory, so it can decrease the performance of applications.
Physical Memory Size: Physical memory is limited to the size of the RAM chips installed in the computer. Virtual memory
is limited by the size of the hard drive, so virtual memory has the capability for more storage.
What Is the Virtual Memory Swap File?
Random access memory or RAM is a computer's physical system memory. The physical memory is used to run applications.
When this memory is overtaxed, the computer relies on virtual memory to help run programs
Virtual Memory: When system memory runs low, Windows uses space allocated from the hard disk drive to act as RAM.
This is the "virtual memory." The maximum amount of allocated space is usually equal to half the amount of RAM installed.
This gives the computer 50 percent more memory to run applications.
Swapping: When RAM space becomes available, the memory management unit (MMU) swaps the temporary files back into
physical memory files. The act of moving the files is known as "swapping" or "paging."
16/16