How does gitlab choose which identical runner to use?

As such GitLab doesn’t choose. All of the active runners check regularly (I don’t remember the interval, but it’s less than one minute by default) if there are jobs they should handle (by tags mostly), and if there is, they pick up the job.

If you’re not happy with how jobs are distributed among your runners, the most direct way to change allocation is to tags jobs, and configure runners to only run jobs with a specific tag (and/or untagged jobs).
A couple of less direct ways (I haven’t tried any of them, so I don’t know how well they work, I also don’t know how to configure it specifically):

  • configure the runners concurrency settings to make the more loaded ones run fewer jobs in parallel and/or make the less loaded ones run more jobs.
  • configure the frequency with which the runners check for new jobs. If the less loaded ones check more frequently than the more loaded ones, they should pick up more jobs.
3 Likes