【Azure Database for PostgreSQL】予期しないメモリ使用量の増加について

TM107710 40 評価のポイント
2025-07-12T02:17:28.0266667+00:00

現在、「Azure Database for PostgreSQL のフレキシブル サーバー」を利用しているシステムを運用しております。

先日までDBのメモリ使用率は25%前後で安定しておりましたが、2025/7/10(木) AM 3:15~3:30にかけてメモリ使用率の急激な増加が発生し、現在メモリ使用率は65%前後で稼働している状態となっております。

上記時間帯では、DBに負荷がかかるシステムの処理は実行されておらず、またDBの設定変更を行っておりません。

こちらメモリ使用率が急激に増加した理由は何になりますでしょうか?

本件について、原因およびメモリの使用率を下げる対処方法についてご教示頂けますと幸いです。

コンピューティングサイズ:Standard_D4s_v3(4 vCore、16GiB メモリ、6400 最大 iops)

※Azure Portal にてDBの停止・開始を試してみましたが、効果はなく現在も65%で稼働しております。

※過去30日間のメモリ使用率を確認しましたが、7/10(木)以前は25%前後で安定しておりました。

20250711_postgreSQLのメモリ使用率増加について

Azure SQL Database
Azure SQL Database
Azure リレーショナル データベース サービス。
{count} 件の投票

承認済みの回答
  1. Oury Ba-MSFT 21,101 評価のポイント Microsoft 社員 モデレーター
    2025-07-22T22:55:27.5366667+00:00

    TM107710 Thank you for being patient while working on this issue.

    We can see 50% of memory is allocated only for shared_buffers that explains the high memory consumption.

    In PostgreSQL, there is a configuration parameter called huge_pages that controls the use of huge memory pages for shared_buffers. For your server, this parameter is set to "try," which means that PostgreSQL will attempt to use huge pages if available, but will fall back to regular pages if they are not. During the last restart, PostgreSQL successfully allocated huge pages for the shared_buffers value, which is set to 8 GB for this server. Given that the server has a total memory of 16 GB, you will observe in the metrics that memory consumption is at a minimum of > 50%. This explains the observed increase in memory usage following the maintenance.

    Huge Pages is a good feature, it can improve the performance of PostgreSQL by reducing the overhead of managing a large number of small memory pages and improve Translation Look aside Buffer (TLB) hit rates, which can reduce the number of times the CPU needs to access the page table. But if you want to 100% disable, they can set huge_pages server parameter to "OFF".

    Why it was allocated this time, and was not before, because of the fact huge pages require contiguous blocks of memory. If the system does not have sufficient contiguous memory available at the time PostgreSQL starts or attempts to allocate huge pages, it will not be able to use them. Fragmentation in the system's memory can affect the availability of contiguous memory blocks, in other words previously was not used the huge pages due to that, take into account the setting of PG parameter is set to “try.

    Please comment below if you have additional ask.

    Please don't forget to mark as accept answer if the reply was helpful.

    Regards,

    Oury


1 件の追加の回答

並べ替え方法: 最も役に立つ
  1. 削除済み

    この回答は当社の行動規範に違反したため削除されました。 アクションを実行する前にこの回答を手動で報告したか、自動検出機能により特定しました。 詳細については、当社の行動規範を参照してください。


    コメントはオフになっています。 詳細情報

お客様の回答

回答は、質問作成者が [承諾された回答] としてマークできます。これは、ユーザーが回答が作成者の問題を解決したことを知るのに役立ちます。