3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

HANADB再起動後 メモリ内のローストア再利用について

Last updated at Posted at 2025-02-20

はじめに

同じ環境でHANADB単体のみ再起動した場合と、OS再起動後にHANADBを起動した場合で起動時間が異なるので、その原因を調査してみました。
※確認した環境 OS:SUSE15 SP4 DB:HANA2.0 SPS05 メモリ 123GB

起動時間が異なる原因

Note 2159435曰く、HANA再起動後にはメモリ内のローストアが再利用されるようで、HANA再起動する際に起動時間が短縮されるようです。
SAP HANA 2.0 SPS04以降であれば、異常終了、クラッシュした場合でも、HANA再起動時にメモリ再利用される。

2159435 - How-To: Keeping SAP HANA Row Store in Memory when restarting
Starting with SAP HANA 2.0 SPS 04 the row store in memory is re-used, even in case of a dirty shutdown / crash - only dirty pages are reloaded from disk. The re-use ratio is written to the database trace (SAP Note 2380176):
Service_Startup SharedMemoryUtil.cc(01971) : 1 RS segments loaded in 1.25 sec (51.05MB/s), 277 pages in 1 segments, reuse ratio: 93%

HANADB単体のみ再起動した場合
image.png

OS再起動後にHANADBを起動した場合
image.png

上記ログ記載にもある通り、HANA再起動の場合ではService_Startup SharedMemoryUtil.ccの行にreuse ratioの記載があり、メモリ内のローストアが再利用されている一方、OS再起動後にDB起動した場合はreuse ratioの記載がなく再利用されていないようです。

DBパラメータ(keep_shared_memory_over_restart)

2159435 - How-To: Keeping SAP HANA Row Store in Memory when restarting
indexserver.ini -> [row_engine] -> keep_shared_memory_over_restart
1.0 SPS 09 and higher true
If set to true, SAP HANA will keep the row store in memory when the technical preconditions are fulfilled. If set to false, the row store is generally recreated from scratch during a startup.

SAP HANA 1.0 SPS 09以降ではkeep_shared_memory_over_restartというDBパラメータで、DB再起動後のメモリ内のローストア再利用が制御されており、デフォルト値がtrueとなっておりました。(Note2159435参照)
→SAP HANA 1.0 SPS 09以降では、デフォルトでDB再起動後にメモリ内のローストアが再利用される設定になっている。

起動時間比較

今回実施した環境ではローストアのロード処理時間(RowStorePageAcce AbsolutePageAccessImpl.cpp)は以下の通りでした。HANADB単体のみ再起動した場合はメモリ内のローストアが再利用されるので、その分起動時間が短縮されていました。今回下記それぞれの場合での差は約3分半程度でしたが、再利用するメモリのデータ量が多くなれば、そのぶん差は広がることが考えられます。
 HANADB単体のみ再起動した場合 30秒程度
 OS再起動後にHANADBを起動した場合 4分程度

HANAの仕様上、ローストアは起動時にすべてメモリ内にロードされます。一方、カラムストアは起動時にすべてメモリ内にロードされるわけではなく、起動後も徐々にメモリにロードされていきます。

image.png
画像は下記sap learningのリンクから引用
https://learning.sap.com/learning-journeys/installing-and-administering-sap-hana/starting-and-stopping-sap-hana

おわりに

誰かの参考になれば幸いです。

3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?