High memory usage for Gitlab CE

Viewed 46034

Look at this picture showing gitlab ce memory consumption. gitlab ce memory consumption

I really dont need all of those workers, sidekiq or unicorn or all of those daemon. This is on IDLE. I mean, I installed this to manage 1 project, with like 4 people, I dont need all those daemon. Is there any way to reduce this ?

9 Answers

I had the same problem: a vanilla Gitlab on vanilla Ubuntu 20.04, would last maybe a day before crashing without any load. Bare metal EPYC, 8c /16t and 64 GB of RAM.

Postgresql was taking its 15G share as mentioned by BrokenBinary's answer, but even "fixing" that to 2G did not suffice.

I also had to fix the amount of Puma workers:

puma['worker_processes'] = 2

It seems that newer Gitlab installations will have memory leaks using the replacement for unicorn, which had memory leaks.

Update: Crashed again. Next try:

sidekiq['max_concurrency'] = 6
sidekiq['min_concurrency'] = 2

Fast forward to 2022, my GitLab v15 instance was using up its entire allotment of memory. I checked & tested some of the recommendations from this guide: Running GitLab in a memory-constrained environment. The changes that in my case reduced memory usage were:

################################################################################
## GitLab Puma
################################################################################

puma['worker_timeout'] = 120
puma['worker_processes'] = 1

################################################################################
## GitLab Sidekiq
################################################################################

sidekiq['max_concurrency'] = 10

I verified the effectiveness of the changes by checking the Service Level Indicators metrics in Grafana's dashboard (/-grafana).

Service Level Indicators

When I changed the /etc/gitlab/gitlab.rb as mentioned in other answers it did not worked for me.

This is what I did, I edited the following file:

/var/opt/gitlab/gitlab-rails/etc/unicorn.rb (Perhaps the path to the file in your machine is different)

And changed worker_processes 9 to worker_processes 2.

I'm running gitlab-ce on Raspberry 4B 8GB.

Setting:

sidekiq['max_concurrency'] =4
postgresql['shared_buffers'] = "256MB"

Did help.

Related