Gitlab: Extremely high memory consumption by ruby "bundle" process

Those will be the unicorn workers and sidekiq. They appear to be using the correct amount of memory. 2GB is about the bare minimum of RAM to run gitlab; if your system has much of any activity you'll want 4GB or more.

I have a personal gitlab instance on 2GB of RAM as well, and it shows similar usage:

top - 23:30:42 up 5 days,  7:53,  1 user,  load average: 0.04, 0.03, 0.05
Tasks: 172 total,   2 running, 170 sleeping,   0 stopped,   0 zombie
%Cpu(s):  1.2 us,  0.2 sy,  0.0 ni, 98.7 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :  2048816 total,    72636 free,  1762504 used,   213676 buff/cache
KiB Swap:  1048572 total,   801180 free,   247392 used.    73972 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND     
  664 git       20   0  715620 458296   2964 S   3.0 22.4 139:48.55 bundle      
 1623 git       20   0  543608 327472   3044 S   0.0 16.0   3:46.02 bundle      
 1626 git       20   0  543608 324384   3224 S   0.0 15.8   3:51.97 bundle      
 1620 git       20   0  543608 324244   3088 S   0.0 15.8   3:51.68 bundle      
 1556 git       20   0  510840 149736   2616 S   0.0  7.3   0:18.45 bundle    

Note that top doesn't show you what the processes are really doing, but you can easily find out with ps. For instance:

# ps 664
  PID TTY      STAT   TIME COMMAND
  664 ?        Ssl  139:49 sidekiq 4.2.1 gitlab-rails [0 of 25 busy]
# ps 1556
  PID TTY      STAT   TIME COMMAND
 1556 ?        Sl     0:18 unicorn master -D -E production -c /var/opt/gitlab/gitlab-rails/etc/unicorn.rb /opt/gitlab/embedded/service/gitlab-rails/config.ru

GitLab CE wants to use at least 4GB of RAM. So if you have 2GB RAM, GitLab tries to add another 2GB of memory by using SWAP, which results in 2GB of swap memory. This makes GitLab very slow, even if you're the only user.

The solution: Your machine must have at least 4 GB RAM or more. Don't waste your time on tweaking the GitLab's configuration file, just make sure you have hard 4 GB of RAM.

Read the 'Memory' section of this GitLab's document: https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/requirements.md

Good luck!


I know this thread is a lil stale but does anybody else still encounter this? I'm on a physical box with 24GB and 12cores/24threads and I'm seeing bundle forked like mad until it sucks up all memory. I looked in gitlab config and found sidekiq concurrency is set to 25 by default - apparently that means up to 25 copies of bundle running? It creates as many as it can before out of memory. Crazy.