ITで遊ぶ

PostgreSQL JDBCドライバーの注意点

https://wiki.postgresql.org/wiki/FAQ からの抜粋。日本語では見かけなかったので。

Why does PostgreSQL use so much memory?

Despite appearances, this is absolutely normal, and there’s actually nowhere near as much memory being used as tools like?top?or the Windows process monitor say PostgreSQL is using.

Tools like?top?and the Windows process monitor may show many?postgres?instances (see above), each of which appears to use a huge amount of memory. Often, when added up, the amount the postgres instances use is many times the amount of memory actually installed in the computer!

This is a consequence of how these tools report memory use. They generally don’t understand shared memory very well, and show it as if it was memory used individually and exclusively by each postgres instance. PostgreSQL uses a big chunk of shared memory to communicate between its backends and cache data. Because these tools count that shared memory block once per?postgres?instance instead of counting it once for?all?postgres?instances, they massively over-estimate how much memory PostgreSQL is using.

?どうしてPostgreSQLは大量にメモリーを使っているように見えるか?

見かけと違って、これは絶対に正しい動きです。WindosのプロセスモニターやTopコマンドなどで、どこでもPostGreSQLで多くのメモリー消費されているといいます。

TopコマンドのようなツールやWindowsのプロセスモニターは多くのPostgresのインスタンスを表示し、それぞれが巨大なメモリーを消費しているようにいいます。それどころかpostgreインスタンスが大量にメモリーを消費するからと多くのメモリーを導入したという話を何度も聞きます。

これはメモリー使用レポートツールによるものです。共用メモリーについてまったく考慮していません。それぞれのPostgresインスタンスがそれぞれ大量にメモリーを消費しているかのように見えるのです。PostgreSQLはバックエンドとキャッシュデータの間のコミュニケーションのために大量の共用メモリーを使います。これらのツールはそれをそれぞれのインスタンスについてカウントします。結果的にPostgreSQLが大量にメモリを消費しているように誤解するのです。

 

関連記事

  1. 製品を作るおじさんの独り言

  2. python 正規表現で文字列判定

  3. JqueryMobileにホレボレ

  4. PHP, Python, Ruby, バランス

  5. wxPython (PythonのGUI)

  6. JavaScriptグラフィック(2)

  7. micro:bit + BLE + ChromeブラウザーそしてPro…

  8. DOAの落とし穴

記事をプリント