HANA Memory RCA
HANA Memory RCA
.
HANA memory RCA roadmap
OOM or
memory constraint Analysis
Delta Merge
Sizing is done
Properly?
Check Locks
Rev, Hardware, Crash Dump, Yes
Known issue?
Known issue
In temporary
calculation Review Sizing
No
Memory in
Parameter is No Data Store
Parameters
correct/optimized
Yes
No
Memory Single query Investigate
Monitoring Memory Issue Single query
Analyze
Memory leak
Memory Leak
© SAP 2007 / Page 2
Memory parameters(1)
global_allocation_limit
90% of Physical RAM size. ( other 10% is reserved for Linux).
Some situation it could be less than 90%, for example, due to license limitation.
Even for large node with 1TB RAM, it’s not recommended to increase
global_allocation_limit.
On most HANA systems, preprocessor is not needed(at least for now, might
change in the future), in some cases even the XSEngine and webdispatcher, you
can switch them off. (see SAP Note 1697613 to remove xsengine).
Nameserver and Statisticsserver must never be switched off, and don’t try to limit
memory for nameserver.
Memory_merge_decision_func:
Use_shared_memory: true
Statisticserver:
[joins] plan_cache_size: (Byte)
allocationlimit: 5%, 10%
[joins]udiv_cache_size: 0
minallocationlimit: 5120 (MB)
[sql]plan_cache_enabled: True
[sql]plan_cahe_statistics_enabled: false
[sql]plan_cache_size: (Byte)
[sql]query_cache_size (Byte)
[sql]plan_cahe_statistics_enabled:true
[cache]resultcache_enabled: no
[cache]resultcache_maximum_value_size_in_bytes
SQL Statement:
SELECT TOP 3 HOST, PORT, SERVICE_NAME, TOTAL_MEMORY_USED_SIZE
FROM M_SERVICE_MEMORY
ORDER BY TOTAL_MEMORY_USED_SIZE DESC
HANA Studio:
Additional analysis needs to be done (what kind of queries run on the table,
DML/Selects and how the table is accessed from application, single columns or
select * ).
Column store is preferable as it provides more compression and also they are
unloadable. In case of memory shortage, less frequently used tables would be
unloaded reducing the chance of OOM .
1. Analyze the modeling for the query, check the number of records, see if it's
selecting too many records, need optimization or not, can also find out memory
information from performance trace.
Memory usage
during delta merge
The delta merge operation can be expensive for the following main reasons:
The complete main storages of all columns of the table are re-written in memory. This
consumes some CPU resources and at least temporarily duplicates the memory needed for
the main storages (while Main 1 and Main 2 exist in parallel).
The complete main storages are persisted to disk, even if only a relatively small number of
records were changed. This creates disk I/O load.
Splitting tables. The performance of the delta merge depends on the size of the main
storage. This size can be reduced by splitting the table into multiple partitions, each with its
own main and delta storages. The delta merge operation is performed at partition level and
only for partitions that actually require it. This means that less data needs to merged and
persisted. (there are disadvantages to partitioning tables that should also be considered.)
More information from delta merge, refer to How to Guide: “How To Delta
Merge for SAP HANA and SAP NetWeaver BW”
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/10681c09-
6276-2f10-78b8-986c68efb9c8?overridelayout=true
Long lock on uncommitted transaction could hold the memory from being
used by other transactions until the lock is released.
1. Check the history how memory behaving, if the memory keep climbing, most
possibly caused by keeping loading data into HANA. If there is no data loading
happening but memory keeps climbing, there is potential memory leak.
2. From memory history, if there is sudden drop in the memory used, most posisbly
caused by GC or memory consuming transaction cancelled.
Translation table is used for cached translation between two columns, used for
joining in the JoinEngine, the C++ allocator for translation table is
Pool/JoinEvaluator/TranslationTable.
In certain scenarios when many temporary tables are joined, the cache grows
with "useless" translation tables.
Limit the size of the cache with. ( or HANA studio indexserver.ini, joins):
ALTER SYSTEM ALTER CONFIGURATION ('indexserver.ini', 'SYSTEM') SET
('joins', 'translator_cache_size') = '500' with reconfigure
Default value is 2000, but much lower values are probably enough for most
scenarios. However, if the cache is too small it will impact the performance.
Many different versions of tables will take too much memory, how to check:
If there are too many versions (e.g. more than 1,000,000 or keeps growing), find out
who is blocking the garbage collection - possibility: (1) long-running or unclosed
cursors, (2) long-running Serializable/RepeatableRead-isolation-mode
transactions, (3) hanging threads.
Make sure house keeping job running to bring the row store table size under
control, house keeping job only delete the data, not releasing memory, need to
run de-fragmentation to release memory.
Lob columns could take a lot of memory, for less frequently used LOB columns,
put on harddisk instead of in memory.
2. Analyze application SQL statement, for example, select (one column) is more
frequently used than select *.
3. For row store tables not frequently needed, make it unloadable. ( The statement
itself takes a lot of memory, so only do this for big tables.)
4. Not all of the row store tables could be converted to column store tables, for
example, some system tables, statistics tables.
Note 1634681 Database migration: Report to find large row store tables
If too many edges are in the output file it might be good to reduce the edges to
those which have a high memory usage. Edges like
can be erased.
You can also use mm top -r Pool to list the callstacks where memory was allocated.
Unfortunately using allocation stack traces takes some time, especially on Windows.
If you know the allocator which consumes too much memory you should restrict
stack traces to this allocator. You can see which allocator uses how much
memory by using the command mm list -s with Management Console.
© SAP 2007 / Page 22
HANA sizing
SAP HANA sizing notes
a) Perform this test only in a copy of production because the stack tracing will have
serious impact on the system performance. Make sure that you have a few
hundred gigabytes of disk free space. Restart the system before the execution.
b) at the OS console, logon as user <sid>adm, and execute the following commands:
> hdbcons
c) Execute the long running query. (In HANA Studio or Front-End tools)
e) Run command exit from dbcons, Back to Linux and convert the stats into PDF or
GIF.
Go to the directory
where you export
the DOT file
Example PDF
attached
© SAP 2007 / Page 30
To execute mm command from HANA Studio
In cases you don’t have the Linux level access to the HANA box, it’s possible to
execute the management console command from HANA studio with stored
procedure:
Contact information: