
・GitLab18.3でメモリ使用量を節約する方法を知りたい。
・具体的な手順を教えてほしい。
こういった疑問に答えます。
本記事の内容
- GitLab18.3でメモリ使用量を約2GB削減する手順

この記事を書いている私は、某SIerに勤務しながら、
WEB系エンジニア・インフラエンジニアに憧れて、プログラミングおよびインフラ技術の勉強をしています。
こういった私が、解説していきます。
私が実機で試したコマンドや画像を載せて書いています。
記事の信頼性担保に繋がると思います。
GitLab18.3でメモリ使用量を約2GB削減する手順
GitLabのインストール要件
- CPU:推奨最小コア数=4コアで500ユーザー
- メモリ:必要最小限サイズ=4GBで500ユーザー
変更前後のメモリ使用量
変更前

変更後

約2GB,節約できました。
変更した箇所
/etc/gitlab/gitlab.rb
1325 ################################################################################ 1326 ## GitLab Puma 1327 ##! Tweak puma settings. 1328 ##! Docs: https://docs.gitlab.com/ee/administration/operations/puma.html 1329 ################################################################################ 1330 1331 # puma['enable'] = true 1332 # puma['ha'] = false 1333 # puma['worker_timeout'] = 60 1334 puma['worker_processes'] = 1 ←★★★変更 1335 puma['min_threads'] = 2 ←★★★変更 1336 puma['max_threads'] = 2 ←★★★変更 (中略) 1504 ##! **recommend value is 1/4 of total RAM, up to 14GB.** 1505 ##! For Docker containers, the default of 256 MB is set in docker/assets/gitlab.rb. 1506 ##! Otherwise, 1/4 of the total RAM is used in files/gitlab-cookbooks/postgresql/attributes/ default.rb. 1507 postgresql['shared_buffers'] = "1024MB" ←★★★変更 (中略) 2657 ##! To completely disable prometheus, and all of it's exporters, set to false 2658 prometheus_monitoring['enable'] = false ←★★★変更
変更後の再構築と再起動
[root@a-gitlb01 ~]# gitlab-ctl reconfigure [root@a-gitlb01 ~]# gitlab-ctl restart