2

I need to configure GitLab runner to run multiple shared runners in Docker containers at one server (host).

So, I registered two runners with gitlab-runner register as shared runners with same tag.

But there is an issue now - only one of them is currently using and all other tasks are waiting in Pending status until the first runner is stopped. So, second runner instance is not using, until first instance will be stopped.

All tasks have same tag.

How to run multiple runners at same server host?

Arthur
  • 3,253
  • 7
  • 43
  • 75
  • 1
    Could you try increasing the limit/concurrency? Also posting your config.toml here would help. – djuarezg Mar 29 '19 at 12:49
  • Oh, really, I forgot about `concurrent = 1` option in config.toml file. Thank you! – Arthur Mar 29 '19 at 13:26
  • I would accept the answer provided. Running more than 1 gitlab-runner per node is totally unnecessary as it can run concurrent job. As stated setting concurrent=n ,0 is NOT unlimited, will run n job at the same time. – drgn Mar 29 '19 at 18:36

2 Answers2

4

By default concurrent is 1, so unless you increase it your runner will just use one registration at a time: https://docs.gitlab.com/runner/configuration/advanced-configuration.html#the-global-section

limits how many jobs globally can be run concurrently. The most upper limit of jobs using all defined runners. 0 does not mean unlimited

djuarezg
  • 2,307
  • 2
  • 20
  • 34
0

To utilize all your CPU cores set concurrent in /etc/gitlab-runner/config.toml (when running as root) or ~/.gitlab-runner/config.toml (when running as non root) to the number of your CPUs.

You can find the number of CPUs like this: grep -c ^processor /proc/cpuinfo.

In my case the config.toml says concurrent = 8

Citations:

Jürgen Brandstetter
  • 7,066
  • 3
  • 35
  • 30
  • There's no direct correlation between the number of cores and the the value of `concurrent`, best I can tell. Each runner has access to all of the cpu cores granted to it via the host OS (modulated by `cpuset_cpus` if supplied). – Chris Cleeland Apr 20 '20 at 19:27
  • @ChrisCleeland agreed to that, it seems like an arbitrary way of determining how much concurrency to handle. on gitlab's doc site for runner, it mentions memory consumption being the bottleneck. imo, i would set concurrency extremely high and autoscale and balance load based on mem consumption. however, ymmv, if you have jobs that are cpu intense, you're going to have to cater to that – ferr Jun 19 '20 at 19:08