
1、前言
SAP HANA Cloud在Cloud环境中提供了功能及其丰富的HANA多租户(Multi-tenant)相关服务。在安全性和隔离性方面也做的非常完善。但是从数据库使用用户的角度来讲,需要一定的适应过程,甚至要经历一段学习曲线才能熟练使用和掌握。内存的处理是很重要的一块。
这里整理出一些常见的比较重要的点列出来,分享给大家,尤其是碰到SAP HANA 内存相关的问题的时候。
2、介绍
2.1、有哪些重要的内存?
| Memory Area | Context | Level | Details |
|---|---|---|---|
| Physical memory | operating system | global | Total amount of memory physically available on host level (typically RAM) |
| Virtual memory | operating system | process | Total amount of memory allocated by all processes held both in physical memory and in paging area on disk |
| Resident memory | operating system | process | Total amount of memory allocated by all processes held in physical memory, large allocations are usually fine (SAP Note 2081473) |
| Allocated memory | SAP HANA | process | Total amount of memory allocated by the SAP HANA processes, limited by the configurable SAP HANA global allocation limitLess relevant for SAP HANA memory analysis because allocated, but unused memory can be re-used when requiredValues too close to the allocation limit can result in synchronous memory reclaim activities, thus setting parameters gc_unused_memory_threshold_* is recommended (SAP Note 2600030) |
| Used memory | SAP HANA | process | Total amount of memory in use by the SAP HANA processes, relevant to understand SAP HANA memory footprint |
| Shared memory | SAP HANA | global | Memory that can be accessed by different processes, e.g.:Specific row store components (tables, catalog, free)Nameserver topology |
| Heap memory | SAP HANA | process | Memory exclusively accessible by threads of a single process (e.g. indexserver), e.g.:Column storeRow store indexesIntermediate resultsTemporary structuresSAP HANA page cache |
| Persistent memory | SAP HANA | process | Persistent memory / fast restart option (SAP Note 2700084) can be optionally configured to make sure that column store main storages remain in memory in restart / crash scenarios. |
| Code | SAP HANA | global | Code |
| Stack | SAP HANA | process | Stack |
2.2、Memory Pool
内存池的基本结构如下图:
2.2.1 Used Memory
由于代码和程序栈的大小将近6GB,因此几乎所有的内存都用于存储表、计算以及数据库管理。
2.2.2 Virtual Memory
2.2.4 Physical Memory
而Linux系统和HANA内存之间的联系如下图所示:
2.3、列表(Column Table)的内存使用结构
其中Delta Storage那一块很关键,之所以列存能进行大规模压缩,那一块起很重要的作用。数据库的读取总是Main Storage和Delta Storage的"merge"来得到最后的结果的。
2.4、实际内存汇总的实例
2.5、standby的样子
由于HANA在实际的环境中,data, logs跟DB process本身,甚至可以不在一台主机上,于是就出现了上边的这种结构。
SAP的官方文档非常详细,并且有大量的SAP Notes. 参考链接里的那篇文档,就非常非常的长。有兴趣可以进一步深读。本文只是把一些重要的图摘出来,留一个基本的轮廓性的介绍。
参考:
[1999997 - FAQ: SAP HANA Memory]
https://launchpad.support.sap.com/#/notes/0001999997