1
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?

[備忘録] Docker + Postgres環境での共有メモリ不足によるエラー

Posted at

こんなことがあったよという自分への備忘録なので、雑です。

結論

Dockerのコンテナはデフォルトでは共有メモリサイズが64mbしか割り当てられない。
コンテナ立ち上げ時に--shm-sizeオプションで割り当てる必要があった。

経緯

Dockerを使い、Pythonコンテナ、Postgresコンテナ、Grafanaコンテナをそれぞれ立ち上げ、Pythonで処理したデータをPostgresへ格納し、Grafanaで表示させていた。

100msecデータであったため、Grafanaで表示する際に時間幅を広くとるなどを行うと、グラフ表示まで時間がかかるというような課題があった。

パフォーマンスチューニングに関する記事を見つつPostgresの設定値を変えるも、特に効果が無く見えた。
(この時点で感づくべきだった)

そして、チューニング後から、1日に3~5回程度ではあるがcould not resize shared memory segment <中略> No space left on deviceといったエラーが確認されるようになった。

推測

深追いしていないので推測にはなるが、64mbしか割り当てられていないに関わらず、Postgresの設定値変更により、デフォルト設定値よりも多くのメモリ確保を行うようになっていたため。

1
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
1
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?