Used memory serves several purposes:
The stack is needed to do actual computations.
The heap and shared memory are the most important part of used memory. It is used for working space, temporary data and for storing all data tables.
As explained above, Used Memory is the total amount of memory currently in use by SAP HANA. This is the most precise indicator of the amount of memory that SAP HANA requires at any time.
To display the current size of the Used Memory, you can use the following simple SQL statement
select HOST, round(INSTANCE_TOTAL_MEMORY_USED_SIZE/1024/1024/1024, 2) as "Used Memory GB" from M_HOST_RESOURCE_UTILIZATION
SELECT SERVICE_NAME, CODE_SIZE FROM M_SERVICE_MEMORY
A SAP HANA system consist of multiple services that all consume some memory and the "indexserver" service, is the main database service. The indexserver holds all the data tables and temporary results, and therefore dominates the SAP HANA Used Memory.
---amount of index server Used Memory ---
select HOST, round(TOTAL_MEMORY_USED_SIZE/1024/1024/1024, 2) as "Used Memory GB" from M_SERVICE_MEMORY where SERVICE_NAME = 'indexserver'
This will list all the hosts in the system, and the amount of indexserver Used Memory per host. Similarly, the memory consumption of other services (like the Statistic service) can be examined.
Used Memory over time:
The value of Used Memory represents a current measurement, but it is ultimately more important to understand the behavior of Used Memory over time and under peak loads.
A snapshot copy of Used Memory is periodically saved in the HOST_RESOURCE_UTILIZATION_STATISTICS system table, providing you with a very useful time-series.
For instance, to see the peak amount of Used Memory since the server was restarted:
select top 1 HOST, SERVER_TIMESTAMP, round(INSTANCE_TOTAL_MEMORY_USED_SIZE/1024/1024/1024, 2) as "Peak Used GB" from _SYS_STATISTICS.HOST_RESOURCE_UTILIZATION_STATISTICS order by "Peak Used GB" desc
In a multi-host system, you can use query by host (where HOST = 'host_name' etc).
Note: value of Used Memory at 7:00 AM during each of the last 30 days:
select top 30 HOST, SERVER_TIMESTAMP, round(INSTANCE_TOTAL_MEMORY_USED_SIZE/1024/1024/1024, 2) as "Used Memory GB" from _SYS_STATISTICS.HOST_RESOURCE_UTILIZATION_STATISTICS where hour(SERVER_TIMESTAMP) = 7 and minute(SERVER_TIMESTAMP) = 0 order by SERVER_TIMESTAMP desc
- Program code and stack
- Working space and data tables (heap and shared memory)
The stack is needed to do actual computations.
The heap and shared memory are the most important part of used memory. It is used for working space, temporary data and for storing all data tables.
As explained above, Used Memory is the total amount of memory currently in use by SAP HANA. This is the most precise indicator of the amount of memory that SAP HANA requires at any time.
To display the current size of the Used Memory, you can use the following simple SQL statement
select HOST, round(INSTANCE_TOTAL_MEMORY_USED_SIZE/1024/1024/1024, 2) as "Used Memory GB" from M_HOST_RESOURCE_UTILIZATION
SELECT SERVICE_NAME, CODE_SIZE FROM M_SERVICE_MEMORY
A SAP HANA system consist of multiple services that all consume some memory and the "indexserver" service, is the main database service. The indexserver holds all the data tables and temporary results, and therefore dominates the SAP HANA Used Memory.
---amount of index server Used Memory ---
select HOST, round(TOTAL_MEMORY_USED_SIZE/1024/1024/1024, 2) as "Used Memory GB" from M_SERVICE_MEMORY where SERVICE_NAME = 'indexserver'
This will list all the hosts in the system, and the amount of indexserver Used Memory per host. Similarly, the memory consumption of other services (like the Statistic service) can be examined.
Used Memory over time:
The value of Used Memory represents a current measurement, but it is ultimately more important to understand the behavior of Used Memory over time and under peak loads.
A snapshot copy of Used Memory is periodically saved in the HOST_RESOURCE_UTILIZATION_STATISTICS system table, providing you with a very useful time-series.
For instance, to see the peak amount of Used Memory since the server was restarted:
select top 1 HOST, SERVER_TIMESTAMP, round(INSTANCE_TOTAL_MEMORY_USED_SIZE/1024/1024/1024, 2) as "Peak Used GB" from _SYS_STATISTICS.HOST_RESOURCE_UTILIZATION_STATISTICS order by "Peak Used GB" desc
In a multi-host system, you can use query by host (where HOST = 'host_name' etc).
Note: value of Used Memory at 7:00 AM during each of the last 30 days:
select top 30 HOST, SERVER_TIMESTAMP, round(INSTANCE_TOTAL_MEMORY_USED_SIZE/1024/1024/1024, 2) as "Used Memory GB" from _SYS_STATISTICS.HOST_RESOURCE_UTILIZATION_STATISTICS where hour(SERVER_TIMESTAMP) = 7 and minute(SERVER_TIMESTAMP) = 0 order by SERVER_TIMESTAMP desc
No comments:
Post a Comment