The gitlab execution on our company internal server eats lots of memory, the server has 32G memory, and gitlab took more than half of it.
1 |
ps aux|sort -k4 |
I found there are lots of unicorn processes running, and each unicorn process is taking 1.5% memory
In
top command output it's displaying as ruby process and took nearly 500MB resident memory (by default top is sorting by cpu usage, pressing < or > key to change sorting column)
1 |
ps aux|grep unicorn|wc -l |
Running above command outputs 34, that means at most 34 unicorn processes are running (some other processes' name also contain unicorn)..
Assume there are 30 real unicorn process running, each takes 500MB memory, then they will take 30*500MB=15GB memory
To decrease unicorn processes count, edit /etc/gitlab/gitlab.rb, and uncomment following line
1 |
#unicorn['worker_processes'] = 2 |
Next restart GitLab
1 |
gitlab-ctl restart |
Now the memory usage is decreased.
(Note that running gitlab-ctl reconfigure will not kill already running unicorn processes)