Skip to content
Ask for a Budget
EngineeringFebruary 23, 20264 min readUpdated on November 11, 2026

How to speed up CI on GitLab Runner: cache, concurrency and tags

How to find the bottleneck (queue, download or CPU) before buying hardware, config.toml with concurrent and limit, tags per job type and a quick-wins checklist.

How to speed up CI on GitLab Runner: cache, concurrency and tags
Índice do artigo
faltam 4 min de leitura

Before you "buy a bigger machine": find out where the bottleneck is

Three things make CI slow (and almost nobody measures them):

  1. Queue: the job is waiting for an available runner.
  2. Download: dependencies and images are downloaded over and over.
  3. CPU/IO: build and tests actually consuming resources.

The order matters because, if the problem is the queue, optimizing the build alone will not fix it.

Where to read each signal

Each of the three has its own place to measure. Look at at least one week of jobs before deciding.

  • Queue: while the job is pending, it is waiting for a free runner. The GitLab jobs API returns, for each job, the field queued_duration (time in queue, in seconds) next to duration (execution time). Compare the two: if the queue adds up to minutes and execution to seconds, the bottleneck is runner capacity, not code.
  • Download: the job log also records what happens before and after the script, such as preparing the executor, pulling the image, restoring the cache and downloading artifacts. Since GitLab 18.9, per-line log timestamps are generally available, and the documentation itself recommends them for finding bottlenecks and measuring how long each step takes. With them, you just subtract the time of one stage from the next. If pulling the image and restoring dependencies takes longer than the script, the gains come from caching and from having a registry close to the runner.
  • CPU/IO: what is left is the script itself. Here the signal is on the runner host: watch CPU, memory and disk while jobs run (with docker stats on the Docker executor, or with the monitoring you already use on the machine). CPU or disk maxed out during tests means resources are short or too many jobs run in parallel.

To mark sections of your own script in the log, GitLab accepts collapsible sections with section_start and section_end markers, each with the Unix timestamp. This helps separate, for example, dependency installation from test execution.

1. Concurrency: concurrent and limit (what changes in practice)

In GitLab Runner, the config.toml file controls how many jobs a runner can process at the same time.

Example configuration:

concurrent = 4

[[runners]]
  name = "dedicated-runner"
  limit = 2
  • concurrent (global) limits how many jobs in total can run at the same time, adding up all runners registered in that config.toml. The value 0 is not accepted.
  • limit (per runner) limits how many jobs that specific runner accepts in parallel. The default 0 means no limit.
  • request_concurrency (per runner) defines how many requests for new jobs the runner makes to GitLab at the same time. The default is 1, and the GitLab documentation points to this value as a cause of delay on high-volume runners. If the queue grows while the runner sits idle, it is worth testing a higher value.

Adjust with care:

  • if you increase concurrency without increasing CPU/RAM, you "just split the pain"
  • for front-end, 2 to 4 stable jobs are usually better than 8 jobs fighting over memory

2. Cache and artifacts: cheap speed-up (and highly underrated)

Cache (dependencies and intermediate build)

Use cache for:

  • node_modules (when it makes sense)
  • the pnpm store / .yarn/cache folder
  • bundler cache (e.g. .vite, .next/cache)

Simple idea: download once, reuse many times.

Artifacts (job outputs)

Artifacts are good for:

  • front-end builds (the output of dist/)
  • reports (coverage, tests)
  • packages to be deployed

Careful: large artifacts slow the pipeline down in another way (upload/download).

3. Runner tags: matching each job to the machine it needs

Separating runners by tags solves two problems:

  • critical jobs do not get stuck behind long jobs
  • you avoid running an "expensive" job on a "cheap" machine

Practical suggestion:

  • runner:fast → lint/typecheck/unit
  • runner:e2e → Cypress/Playwright
  • runner:macos → iOS/macOS
  • runner:windows → Windows-only

4. Docker executor: performance + isolation (with a warning)

The Docker executor is a great choice because each job runs in a container and the environment is reproducible.

A direct speed gain is the if-not-present pull policy: the runner only downloads the image when there is no local copy. The GitLab documentation adds two caveats: do not use this policy on a runner shared by users who may have access to private images, and remember that the local copy does not update itself, so you need to delete the image from time to time to force the new version (and it does not work if the job must always run on the latest image). Another option the GitLab documentation recommends is using the Dependency Proxy or a Docker Hub mirror to shorten image downloads.

The warning is security: depending on the configuration, you may expose yourself to unnecessary risks. The GitLab documentation warns that privileged mode turns off the container's security mechanisms and can allow a job to escape to the host. Treat "isolation" as a requirement, especially if the runner will be shared across projects.

5. Quick checklist of "easy wins" (30 to 60 min)

  • enable cache (dependencies + bundler)
  • reduce downloads (pin base images, registry close to the runner)
  • split the pipeline into smaller, parallelizable jobs
  • limit concurrency to keep things stable
  • put the runner on an SSD and a wired network
  • separate tags (E2E should not compete with lint)

Useful references

Also read

Dedicated runner: how to choose the machine (Mac mini, Windows or Linux)Recurring costs clients must plan for (so an app does not die after launch)What is DevOps?
Previous post
CI/CD caching: how to design keys and avoid stale caches
Next post
Docker layer caching in CI: registry cache or a dedicated runner
Newsletter

One email a month, no noise

What we learn shipping custom software and applied AI.

Related articles

Dedicated runner: how to choose the machine (Mac mini, Windows or Linux)5 min · Engineering
Recurring costs clients must plan for (so an app does not die after launch)5 min · Engineering
What is DevOps?4 min · Engineering
Understanding the Angular framework2 min · Engineering
APIs and microservices: the reinvention of technology2 min · Engineering

Accelerate your business with X-Apps

Ask for a Budget
X-Apps is an IT provider partner and advised by
Gartner
Receive our e-mails
News on software and applied AI.
Follow X-Apps