cancel
Showing results for 
Search instead for 
Did you mean: 

Memory Management of SAP HANA

Former Member

Hi All,

I went through one of the documentation in SAP HANA Memory management .

http://www.saphana.com/servlet/JiveServlet/download/2299-2-12806/HANA_Memory_Usage_v2.pdf

This gave me a really good understanding about the Memory management of HANA .


I had few questions , Which was almost answered in other discussed in one :

But i still have few questions about  Resident and  used memory

Used Memory : Code + Tables + DB Managment

Resident :  what is the formula or content ?

What does this picture refers to ?

Infact the below statements are bit confusing

********************************************************************

When memory is required for table growth or for temporary computations, the SAP HANA code obtains it from the existing memory pool. When the pool cannot satisfy the request, the HANA memory manager will request and reserve more memory from the operating system. At this point, the virtual memory size of the HANA processes grows.

Once a temporary computation completes or a table is dropped, the freed memory is returned to the memory manager, who recycles it to its pool, usually without informing Linux6. Thus, from SAP HANA’s perspective, the amount of Used Memory shrinks, but the process’ virtual and resident sizes are not affected. This creates a situation where the Used Memory may even shrink to below the size of SAP HANA’s resident memory, which is perfectly normal.

*********************************************************************

My doubt here is how  in any given point of time used memory can go below the used memory , because resident memory is always loaded with what is there in used memory , When used memory itslef is less , what does resident contains extra .

Also how to make a relation with HANA used memory , Database Resident memory , Virtual memory .


In case of  a memory issue , what should we check , Used memory of HANA   OR resident memory of HANA  ?

Thanks,

Razal

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi  all,

I am trying understand memory part bit in details ,  as i am building a complete monitoring infrastructure for HANA , and memory is core of HANA  all part of HANA

Can you also help me to understand how to make some difference  for used memory in HANA and Resident memory

When we say that the Resident memory is something from OS point of view  , this is the memory of the OS which is really being used .

So if the  used memory from HANA Perspective is full , OS still have some free memory  which can be used , How that part is managed .

When i say we are out of memory ,  Both used memory from HANA
Resident memory from OS is full ?

OR does the used memory is simply a calculation of Code + table + etc from HANA point of view .

When execute query :

SELECT SERVICE_NAME,ROUND(SUM(TOTAL_MEMORY_USED_SIZE/1024/1024/1024), 2) AS

"Used Memory GB", ROUND(SUM(PHYSICAL_MEMORY_SIZE/1024/1024/1024), 2) AS

"DB RESIDENT Memory GB" FROM SYS.M_SERVICE_MEMORY GROUP BY SERVICE_NAME

  SERVICE_NAME     Used Memory GB DB RESIDENT Memory GB

1 nameserver         6.73           1.7                 

2 preprocessor       5.38           0.24                

3 indexserver        9.19           4.35                

4 scriptserver       7.52           1.83                

5 statisticsserver  8.52           3.87                

6 xsengine          7.92           1.82                

7 compileserver    5.31           0.23                

       

On top of all this , In admin view  i get used memory as 17.87 as used memory and 18.89 as peak  .

How this used memory is summed up in admin view .

I am using version 70 .

Thanks,

Razal

Former Member
0 Kudos

Hi,

  • Resident memory: How much physical memory, how much RAM, your process is using.
  • Virtual memory: How much memory your process thinks it’s using. Usually much bigger than RESIDENT, thanks to the Linux kernel’s clever memory management.

Out of memory situation can happen when virtual memory is exhausted.

This VIRT, RES are part of LINUX memory management, and how it works there - for more information check LINUX forums (eg LINK)

If you are interested in HANA monitoring then focus only on virtual memory (allocated memory by HANA, used, peaks, licensed, etc.)

regards,

Vladimir

Former Member
0 Kudos

Hello,

I will quote from the document


"When (part of) the virtually allocated memory actually needs to be used, it is loaded or mapped to the real, physical memory of the host, and becomes “resident”. ...

It is used to run the Linux operating system, SAP HANA, and all other programs.

Resident memory is the physical memory actually in operational use by a process"

For better understanding i recommend to do not compare resident vs. virtual memory. Resident is memory from OS point of view and virtual memory from HANA point of view (simply said).

You can imagine virtual memory as memory allocated by HANA. With this memory can HANA work - used memory. If it wants to use more memory like allocated then HANA will allocate more memory (virtual memory) until allocation limit. This should be set according to licensed memory. HANA will not release allocated memory because  it assumes it will use it once again. Once HANA tries allocate more memory like allocation limit then it will start with unloading tables from memory (performance issues) or it will crash with out of memory.

What is in used memory is good explained in doc i guess.

For memory issues i will definitely check allocated memory (can not be more like licensed memory), used memory, peaks, basically only memory from HANA point of view.

regards,

Vladimir

Note: Also i suggest upgrade to SPS7 and check memory overview directly in Studio ->

Former Member
0 Kudos

Hi Vladimir,

Thanks a lot , That was really helpful for me .

BR,

Razal