On GitLab.com, how are compute minutes calculated for jobs on hosted runners, and why can a pipeline use more minutes than it took?
answer
- duration times a multiplier
- pending time is free
- machine size sets the factor
- billed to the top-level group
- parallel jobs add up
basics
~20 sEach job's usage is its run time in minutes multiplied by the runner type's cost factor, charged to the top-level namespace. Pipelines add up all their jobs, so parallel jobs make usage exceed the pipeline's wall-clock time.
solid answer
~40 sGitLab computes each job's usage as `job duration / 60 * cost factor`, where duration is the seconds the job actually ran, excluding time spent `created` or `pending`. The cost factor depends on the hosted machine: `1` for small Linux x86-64, `2` for medium, `3` for large, up to `12` for 2xlarge, `7` for the GPU machine and `6` or `12` for the beta macOS machines. The result is added to the job's **top-level** namespace, whoever started the pipeline. A pipeline's usage is the sum of its jobs, so ten parallel ten-minute jobs on the small runner cost 100 minutes for a ten-minute pipeline. Trigger jobs consume nothing, though the downstream pipeline they start does. Usage resets to zero on the first of each month.
go deeper
Remember that compute minutes are run time multiplied by a cost factor, that pending time is free, and that the minutes go to the project's top-level namespace, not to whoever ran the pipeline.
Explain the formula, the cost-factor table by machine size, why parallel jobs and retries add up, and why a trigger job is free while its downstream pipeline is not.
Diagnose a jump in usage from the Usage quotas page: which projects grew, which jobs changed machine type or started running in parallel, and which reductions cut minutes without slowing delivery.
Weigh where CI spend should go: when larger hosted machines are worth their factor, which workloads justify the team's own runners, and how to make teams see the minutes their pipelines cost.
## What a compute minute measures **Compute minutes** are the unit GitLab uses to meter how much work projects run on **instance runners**. On GitLab.com the instance runners are the GitLab-hosted runners, so every job a project runs there draws compute minutes from a **quota** owned by the namespace. Jobs on runners the team registers for its own group or project do not draw on that quota. ## The formula For every job GitLab computes `job duration / 60 * cost factor`: - **Job duration** is the time in seconds the job actually ran. Time spent in the `created` or `pending` status, waiting for a runner, is **not** counted. - **Cost factor** is a multiplier set by the runner type and, for some programmes, by the project type. The figure is added to the usage of the job's **top-level namespace**. If `alice` runs a pipeline in `acme/backend/api`, the minutes land on the `acme` group, not on `alice` and not on the `backend` subgroup. A personal project's minutes land on the user's own namespace. ## Cost factors on GitLab.com | Hosted machine | Cost factor | |---|---| | Linux x86-64 `small` (default) | `1` | | Linux x86-64 `medium` / `large` | `2` / `3` | | Linux x86-64 `xlarge` / `2xlarge` | `6` / `12` | | Linux x86-64 `medium` with GPU | `7` | | Linux Arm64 `small` / `medium` / `large` | `1` / `2` / `3` | | macOS M1 `medium` (beta) | `6` | | macOS M2 Pro `large` (beta) | `12` | | Windows `medium` (beta) | `1` | Projects in the GitLab for Open Source program get a factor of `0.5` on public projects, and public forks of those projects `0.008`. Community contributions to GitLab's own projects use a dynamic discount. ## Why a pipeline can cost more than it took 1. **Parallelism adds up.** Usage is per job. Ten jobs that run side by side for ten minutes on the small runner cost 100 compute minutes even though the pipeline finished in ten. 2. **Bigger machines multiply.** A 30-minute job on `saas-linux-medium-amd64` costs 60 minutes. A larger machine only saves minutes if it shortens the job by more than its factor grows. 3. **Retries and reruns count again.** A retried job runs again and is metered again. Two things do **not** cost minutes: waiting in `pending`, and **trigger jobs**, which never execute on a runner, even when they wait for the downstream pipeline's status. The downstream pipeline itself is metered like any other. ## Reading a bill that doubled When usage jumps month on month, the usual causes are changes in what runs, not in the rate: - jobs moved to a larger machine type, or to macOS, multiplying their factor; - new parallel or matrix jobs, or a pipeline now running on every push to every branch; - a scheduled pipeline running more often, or pipelines triggered by every mirror update; - long jobs that are retried on flaky failures. The group's **Usage quotas** page lists the current month's projects in descending order of compute usage, which tells you where to look. GitLab's own advice for reducing usage includes turning off pipelines for mirror updates, running schedules less often, skipping pipelines that are not needed, making jobs interruptible so a newer pipeline cancels them, running jobs only when needed, and moving some jobs to the team's own runners. How each of those is written in the pipeline belongs to the material on GitLab CI configuration. ## A worked example Take a pipeline with four jobs on GitLab.com hosted runners: - a build job that runs 8 minutes on the default small Linux machine: `8 * 1 = 8`; - three test jobs that run 12 minutes each, side by side, on `saas-linux-medium-amd64`: `3 * 12 * 2 = 72`; - a trigger job that starts a deployment pipeline in another project: `0`, though that downstream pipeline's jobs are metered on their own. The pipeline finishes in about 20 minutes of wall-clock time and costs 80 compute minutes, most of them from the parallel medium jobs. ## The monthly cycle Usage is tracked per calendar month; on the first day of each month the usage counter is `0` for every namespace. On GitLab.com the quota is enabled by default, set by the subscription tier, and paid tiers get a larger one. Purchased additional minutes are used only after the included quota runs out.
- On GitLab.com, can moving a job to a larger hosted machine ever reduce compute usage?Yes, but only if the job speeds up by more than the factor grows. Medium has factor 2, so a 20-minute small job (20 minutes) must finish in under 10 minutes on medium to cost less. Most jobs do not scale that well, so upsizing usually trades minutes for wall-clock time.
- On GitLab.com, a pipeline in a fork targets its parent project. Whose minutes does it use?A pipeline that runs in the fork counts against the fork's top-level namespace. GitLab's guidance for keeping contributor costs down is that a maintainer of the parent project can run the merge request pipeline in the parent project instead, which then counts against the parent's namespace.
Compute minutes work like a taxi meter with a rate multiplier per car class: the meter runs only while you are driving, not while you wait for the cab to arrive, and a larger car runs the meter faster for the same ride.
- Compute minutes follow the pipeline's wall-clock time, not the sum of its jobs.
- Time a job spends pending for a runner is billed.
- Minutes are charged to whoever started the pipeline.
- Every hosted machine type costs the same per minute.
- A trigger job consumes minutes while it waits for the downstream pipeline.