Memory allocation sequence to work processes
Hi Friends,
I will discuss below memory allocation to work process in SAP. Please correct the mistakes if any in the blog.
Memory allocation sequence to dialog work processes in SAP
- What is the memory allocation sequence to dialog work processes in SAP?
- When does a work process go to PRIV mode?
- How to avoid or minimize work process going to PRIV mode ?
- What are the SAP parameters used to define initial roll area, extended memory, heap memory, roll area ?
1. Initially , a defined roll area is used. This roll area is defined by the SAP parameter ztta/roll_first.
Usually ztta/roll_first is set to 1 in SAP so that only necessary amount is allocated to roll memory.
If the memory from the initial roll area( i.e. ztta/roll_first) is not sufficient for the user context then comes extended memory.
- Extended memory is used until the extended memory is full or until the user quota is reached
Extended memory is defined by the SAP parameter em/initial_size_MB and the user quota for dialog work process is defined by the parameter ztta/roll_extension_dia.
If this memory is also not sufficient, then
- The rest of the roll area is used. This roll area is defined by SAP parameter ztta/roll_area.
Once this is also fully occupied then
- The system is forced to use local heap memory (Private memory). Then the work process goes into PRIV mode
Heap memory is available until one of the following occurs :
- either the limit of the heap memory for dialog work processes is reached (abap/heap_area_dia) or the entire heap memory of all work processes(abap/heap_area_total) for an application server reaches its limit.
- Operating system limit for allocation of memory
- The swap space in the host system is used up or the upper limit of the operating system address space is reached.
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. Most of the time, we should try to avoid the situation of work process going into PRIV mode for better performance of the SAP system. This can be done by optimally defining abap/heap_area_total parameter.
Memory allocation sequence to non dialog work processes in SAP
- What is the memory allocation sequence to non dialog work processes (background, update, en-queue and spool work processes in SAP?
- What are the SAP parameters used to define initial roll area, extended memory, heap memory, roll area ?
- What is the memory allocation sequence to non dialog work processes in Windows NT?
Memory allocation sequence to dialog work processes is same in SAP for all the platforms.
However memory allocation sequence to non-dialog work processes is bit different based on Platform. In Windows NT, memory allocation sequence for non-dialog work processes is same as that of dialog work process memory allocation sequence in other platforms.
Memory allocation sequence to non dialog work processes in SAP as below (except in windows NT) :
-
Initially memory is assigned from the Roll memory. Roll memory is defined by SAP parameter ztta/roll_area and it is assigned until it is completely used up.
If the roll memory is full then
- Heap memory is allocated to the non-dialog work process. Heap memory is available until one of the following occurs :
- Either the limit of the heap memory for non-dialog work processes is reached (defined by the SAP parameter abap/heap_area_nondia) or the entire heap memory of all work processes of an SAP application server reaches its limit which is defined by parameter abap/heap_area_total.
- Operating system limits of allocating memory
- The swap space in the host system is completely used up. However this situation should not occur often which results in severe performance issues.
Please check swap space requirements for various platforms and please define swap space optimally to avoid this issue.
- If all the above mentioned heap memory is completely used up then a non-dialog work process can use the SAP extended memory defined by SAP parameter em/initial_size_MB.
"When a work process enters PRIV mode, it remains connected to the user until the user ends the transaction."
According to such statement dialog process is used only for interaction with GUI what about RFC? Are not Dialog processes used for RFC too?
nice one.. 🙂
Hi,
the allocation sequenze for non-dia-wps on Windows Server is the same as for dialog work processes.
Furthermore it can happen, that ztta/roll_extension can't be allocated, because it has to fit together with eg/globa_area_MB into em/address_space_MB (default 4 GB). Because eg/global_area_MB is allocated and commited during startup of the app-server the possible quota ztta/roll_extension can only be reached if sufficient address space is left in the em/address_space_MB window. This behavior is Windows specific. The default of em/address_space_MB has been changed in 7.40 to the same size as em/initial_size_MB.
kind regards
Peter
good one (y)
really a great article, 🙂
just had a query ,How do do we change first roll area size?
Thanks for sharing 🙂
Thanks for sharing 🙂
Dear All,
In Windows Server, is there any method to permanently change the sequence of allocation of memory for batch process, to allow assigning heap first, before assigning extended memory ?
Reason :
We aware in a 2 processor server, some memory access intensive batch jobs (which do a lot of sorting in memory) would be running sometimes much slower, sometimes much faster (in an order by around 2-3 times). We are suspecting that is due to NUMA effect of varied memory performance, which now undergo further verification test by repetitive testing (running on server with 1 processor socket, vs running on server with 2 processor socket) we are still awaiting the result .
As heap should be "owned" by the worker process itself, so I am guessing if OS would take into account of NUMA and prefer to assign memory "local" to the processor, as long as the requested memory size can fit in that NUMA node. (vs extended memory which is assigned for the whole instance and thus probably not able to take care of locality of every running process) We would also take further test about it through RSMEMORY program then.
However, even if the new sequence has proven any effect, RSMEMORY setting would gone by every time instance restart. So I would like to know if there is chance to persist the sequence
Dear All,
I still do not know how to permanently change the squence of allocation of memory, though it is no longer required for my case, as our test proved NUMA is not the cause.
Sorry for any misleading I might cause, just in case if you read my comment above .
"Can memory allocation sequence be change permanently ?
Eric,
there is currently no simple possibility available to switch this permanently.
The only way I can imagine is, debug RSMEMORY, catch the necessary code and Place it in a separate report started via batch job after the system start.
regards
Peter
Dear Peter,
Thanks a lot for your advice !
Eric
Good one.
Thanks
Thanks for sharing in details.
Good one.. Keep it up.!!!
Very nicely explained..
thanks for this
Not gud
🙂