Skip to Content
author's profile photo Former Member
Former Member

Queries for Used and Resident memory and comparison with Overview tab numbers

Hi,

I look at the overview tab of the HANA studio for DB used memory and DB resident memory.

When I use the queries 1 ,2 and unix command below, the results match with the numbers displayed in the overview tab.

SQL Query 1 for DB used memory: (Available in HANA documents)

SELECT ROUND(SUM(TOTAL_MEMORY_USED_SIZE/1024/1024/1024), 2) AS
"Used Memory GB" FROM SYS.M_SERVICE_MEMORY;

SQL Query 2 for DB Resident memory: (I created this by observing the table contents)

SELECT ROUND(SUM(PHYSICAL_MEMORY_SIZE/1024/1024/1024), 2) AS
"DB RESIDENT Memory GB" FROM SYS.M_SERVICE_MEMORY;

Unix command: Provides same value as SQL query 2.

cat `ps h -U qp4adm -o "/proc/%p/status" | tr -d ' '` | awk '/VmSize/ {v+=$2} /VmPeak/ {vp+=$2} /VmRSS/ {r+=$2;} /VmHWM/ {rp+=$2} END {printf("Virtual Size = %.2f GB (peak = %.2f), Resident size = %.2f GB (peak = %.2f)\n", v/1024/1024, vp/1024/1024, r/1024/1024, rp/1024/1024)}'

My Questions:

Question 1:Now when I use the query 3 below(just getting the above 2 together with the process name), I observe that used memory is more than the resident memory for some services.

I believe that this is wrong based on the below explanation which is in the official HANA docs.

Can anybody in this forum throw more light on this observation?

SQL Query 3:

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

Explanation on Resident from HANA doc:

"

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, without informing Linux. 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."

Question 2:

SQL Query 5: This query doesn't match with the resident memory value in overview tab. Should it? I mean if it doesn't then is it an issue in the studio?

SELECT ROUND((USED_PHYSICAL_MEMORY + FREE_PHYSICAL_MEMORY)/1024/1024/1024, 2) AS "Physical Memory GB", ROUND(USED_PHYSICAL_MEMORY/1024/1024/1024, 2) AS "Resident GB" FROM PUBLIC.M_HOST_RESOURCE_UTILIZATION

Question 3:

In some Studios(meaning different versions) I have used the result of SQL query 1 doesn't match with the studio number. Can we consider this as an issue in the studio?

Question 4:

From the explanation above, can we understand that the Resident size increases since the freed memory is not released to the OS but to the HANA memory pool?

How do we differentiate between DB used and DB Resident memory?

The definition for both are same-> Physical memory in use by the process.

Used memory=" Code+stack+HANA memory pool(Tables,temporary computations)

Resident memory=?

Regards,

Sandeep

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Sep 18, 2013 at 07:11 AM

    Hi Sandeep,

    First I ran your query 1, 2, and 3.

    In my case Used memory is less than resident memory (Comparing Query 1 and 2).

    For query 3, Used Memory is more than Resident memory only for the services: nameserver, preprocessor, xsengine and compileserver.

    Lets have a look on the below image:

    Coming to your Question1: Used memory should not be greater than resident memory.

    From the above image, it is normal that Used memory fluctuates over resident memory and there is a chance that for some of the services, Used memory is more than resident memory.

    For your remaining questions, I will try to respond later.

    Regards

    Raj


    Memory.jpg (65.0 kB)
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 26, 2015 at 10:58 AM

    Hi Lars,

    There is still something i am not able to understand. Are HANA used Memory and HANA Resident Memory related? Resident memory means the Physical memory being used by HANA processes.

    so i would assume that HANA Used memory should not be more that Resident memory as HANA appliance has no swapping and is completely in-memory but the documents mention that HANA used memory can be more than HANA resident memory. How is this possible? Does HANA Used memory also account so some disk space which is not from Physical memory? or rather kindly explain the below situation and how that could happen.

    At certain point HANA Resident memory is less that HANA Used Memory. What are the reasons for this to happen?

    Best Regards,

    Lohit

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 15, 2016 at 10:15 PM

    This message was moderated.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.