James Walker

James Walker

Web Developer

How to improve GitLab performance on a Raspberry Pi

Published on Sunday July 16 2017 at 10:40 in General posts

Running GitLab on a Raspberry Pi can be a painful experience at first. My first attempt at using the web interface after installation proved to be excruciating, with many pages taking close to a minute to load and requests frequently timing out. In this post, I'll share two simple changes that can make GitLab much more usable on a Pi.

Tip 1 – Increase the number of Unicorn processes

This gives GitLab's Unicorn server more processes to run on, which will improve overall performance. By default, 2 processes are used. I recommend upping it to 4.

In /etc/gitlab/gitlab.rb:

unicorn['worker_processes'] = 4

Then reconfigure GitLab to apply the change:

sudo gitlab-ctl reconfigure

Tip 2 – Increase the available swap space

GitLab requires at least 4GB of memory, including swap space, to run. If you're using a Raspberry Pi 3, you'll have only 1GB of RAM with a further 100MB of default swap space. This is far below the minimum requirements, hence why performance leaves a lot to be desired and requests time out.

I recommend increasing the swap space to at least 4GB.

In /etc/gitlab/gitlab.conf:

CONF_SWAPSIZE=4096

Ideally, you should avoid using your SD card for swap space. A USB hard drive will increase the life of the SD card, allow you to add more swap space and potentially improve performance. I'm using a fast external hard drive for my swap space. Reboot your Pi to apply the changes.

Conclusion

These simple tweaks make GitLab usable on a Raspberry Pi. While pages still take a few seconds to load, I haven't had any requests time out or see the entire system go unresponsive since making these changes. The Pi isn't the ideal platform to use GitLab on for sustained periods but by upping the swap space and Unicorn processes you can get a fully-functioning installation.

See also: https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/requirements.md