Reduce memory footprint of Gitlab CE

Why

I installed Gitlab CE using the Omnibus instead of docker and noticed that it required almost all my memory, 4Gb, on a small VPS so I tried to investigate if I could reduce the memory a bit.

So with maximum of 5 developers in mind I tried to tweek the memory so it will suite our needs.

Currently the footprint was 3.8Gb used by Gitlab.

Postgresql

It seems most of the memory was taken by the postgresql which took abou 1/4th of the total ram. So I reduced it to 256mb which should be plenty.

postgresql['shared_buffers'] = "256MB"

Prometheus

I also disabled prometheus monitoring, which also used a lot of memory.

prometheus_monitoring['enable'] = false

Sidekiq

Sidekiq is a background processing for Ruby. The default values for sidekiq concurrency is 25 which I reduced to 1. 1 is maybe to little and we need to revisit this, but I couldn’t see any problems with just 1 so I ran with it.

sidekiq['concurrency'] = 1 #25 is the default

Unicorn

Unicorn is http server. The workerprocess sets the number of worker processes to launch. It is important to know how much memory does one process take, the default is 2 so I changed it to 1.

unicorn['worker_processes'] = 1 #2 is the default

Outcome

After running the reconfigure, the total memory consumption is now 1.6Gb, it is a reduction of almost 2.2 Gb, I think that was worth the time 🙂