Reducing the amount of memory used by gitlab
30th Jul 2017
Gitlab is a fantastic tool. Rather than going with a saas solution for source control and for continuous integration, I'd thoroughly recommend hosting your own gitlab instance. Don't be scared!
Anyway, I run my own gitlab instance on a box that only has 4 gigs of ram. Gitlab also has to share these limited resources with a few other webapps.
I noticed that gitlab was one of the biggest consumers of the ram on my box, and did some research into reducing it's memory footprint.
Open the gitlab config file, which should be located at /etc/gitlab/gitlab.rb.
Reduce the postgres database cache
##! **recommend value is 1/4 of total RAM, up to 14GB.**
postgresql['shared_buffers'] = "256MB"
Reduce the concurrency level in sidekiq
I set this at 15 instead of 25 as I don't have that many commits going on.
sidekiq['concurrency'] = 15 #25 is the default
Disable prometheus monitoring
prometheus_monitoring['enable'] = false
Restart gitlab and test it out:
Run:
gitlab-ctl reconfigure
You should then run through a few commits and check gitlab is running smoothly.