Skip to content

Conversation

@thomasbreland
Copy link
Contributor

The number of jobs should scale with the runner CPU count, up to a point. The bottleneck becomes network / disk I/O at very large numbers, and 8 seems like a reasonable maximum based on my experience at this time.

Many of the private repos that I work on use runners with GitHub-hosted runners with only 2 cores, and oversubscribing there can actually lead to slower runs.

The number of jobs should scale with the runner CPU count, up to a
point. The bottleneck becomes network / disk I/O at very large numbers,
and 8 seems like a reasonable maximum based on my experience at this
time.
@eregon
Copy link
Member

eregon commented Oct 26, 2025

#673 (comment)

So I think 4 was and might still be the fastest on the GH-hosted runners.
Could you benchmark that by doing some runs with various values for jobs?
I wouldn't want to make the install slower on GH-hosted runners.

@thomasbreland
Copy link
Contributor Author

This is likely because most public runners have four cores; in this case, the result here would be the same - it would still use four jobs. Private default runners and paid larger runners do not all have the same number of CPU cores.

https://docs.github.com/en/actions/reference/runners/github-hosted-runners#standard-github-hosted-runners-for--private-repositories

@eregon
Copy link
Member

eregon commented Oct 27, 2025

That page says Linux & Windows have 2 CPU, macOS 3 or 4.
But let's see the number of jobs used in the CI directly which probably includes hyperthreads.

bundler.js Outdated
}

// Number of jobs should scale with runner, up to a point
const jobs = Math.min(os.cpus().length, 8)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be os.availableParallelism() maybe? I found https://stackoverflow.com/a/77532237/388803
Also os.cpus().length doesn't seem to work on Windows, see CI results

Copy link
Member

@eregon eregon Oct 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it should from the https://nodejs.org/api/os.html#oscpus docs, I pushed a commit to try os.availableParallelism()

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmh, that doesn't seem to work on Windows either :/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah the error probably means it needs to be a string and not a number for CLI arguments

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. I should know by now that Windows is particular about objects and types. I've been working mostly on Mac and Linux, and I figured the tests runners would catch any issues anyway, but this is good to know.

@eregon
Copy link
Member

eregon commented Oct 27, 2025

That page says Linux & Windows have 2 CPU, macOS 3 or 4. But let's see the number of jobs used in the CI directly which probably includes hyperthreads.

From https://github.com/ruby/setup-ruby/actions/runs/18838903560/job/53746296174?pr=822#step:3:59
ubuntu-22 & 24 & ubuntu-arm variants & macos-13 & macos-15-intel: 4 jobs
macos-14 & macos-15: 3 jobs

So it looks safe indeed and shouldn't be slower except maybe a little bit on macOS arm64 (3 instead of 4).

* As https://nodejs.org/api/os.html#oscpus says:
  os.cpus().length should not be used to calculate the amount of parallelism available to an application. Use os.availableParallelism() for this purpose.
Copy link
Member

@eregon eregon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR

@eregon eregon merged commit d5126b9 into ruby:master Oct 27, 2025
@thomasbreland
Copy link
Contributor Author

That page says Linux & Windows have 2 CPU, macOS 3 or 4. But let's see the number of jobs used in the CI directly which probably includes hyperthreads.

From https://github.com/ruby/setup-ruby/actions/runs/18838903560/job/53746296174?pr=822#step:3:59 ubuntu-22 & 24 & ubuntu-arm variants & macos-13 & macos-15-intel: 4 jobs macos-14 & macos-15: 3 jobs

So it looks safe indeed and shouldn't be slower except maybe a little bit on macOS arm64 (3 instead of 4).

My bet is that it will still be marginally faster on average, because it will just use three jobs, but that it won't be a huge difference overall. Using slightly more jobs than the number of cores does not always slow things down, but it can because of context switching and overhead / higher memory usage. In general, if nothing else is running, using the same number as core count is a safe bet until you get into extreme parallelism. In cases where you have other services running such as PostgreSQL or Redis, it might make sense to use even less.

mergify bot added a commit to robfrank/linklift that referenced this pull request Oct 30, 2025
Bumps the github-actions group with 4 updates: [graalvm/setup-graalvm](https://github.com/graalvm/setup-graalvm), [anchore/scan-action](https://github.com/anchore/scan-action), [github/codeql-action](https://github.com/github/codeql-action) and [ruby/setup-ruby](https://github.com/ruby/setup-ruby).
Updates `graalvm/setup-graalvm` from 1.4.1 to 1.4.2
Release notes

*Sourced from [graalvm/setup-graalvm's releases](https://github.com/graalvm/setup-graalvm/releases).*

> v1.4.2
> ------
>
> What's Changed
> --------------
>
> * Upgrade musl-toolchain to `1.2.5-oracle-00001`. by [`@​fniephaus`](https://github.com/fniephaus) in [graalvm/setup-graalvm#189](https://github.com/graalvm/setup-graalvm/pull/189)
>
> **Full Changelog**: <graalvm/setup-graalvm@v1.4.1...v1.4.2>


Commits

* [`eec4810`](graalvm/setup-graalvm@eec4810) Bump version to `1.4.2`.
* [`0f48fc0`](graalvm/setup-graalvm@0f48fc0) Extend musl test matrix.
* [`3716035`](graalvm/setup-graalvm@3716035) Upgrade musl-toolchain to `1.2.5-oracle-00001`.
* See full diff in [compare view](graalvm/setup-graalvm@2a24120...eec4810)
  
Updates `anchore/scan-action` from 7.0.2 to 7.1.0
Release notes

*Sourced from [anchore/scan-action's releases](https://github.com/anchore/scan-action/releases).*

> v7.1.0
> ------
>
> New in scan-action v7.1.0
> -------------------------
>
> * chore(deps): update Grype to v0.102.0 ([#536](https://github.com/anchore/scan-action/issues/536)) [[[anchore-actions-token-generator[bot]](https://github.com/apps/anchore-actions-token-generator)]([https://github.com/[anchore-actions-token-generator[bot]](https://github.com/apps/anchore-actions-token-generator))]](https://github.com/%5Banchore-actions-token-generator%5Bbot%5D%5D(https://github.com/apps/anchore-actions-token-generator))%5D)
> * chore(deps-dev): bump lint-staged from 16.2.5 to 16.2.6 ([#535](https://github.com/anchore/scan-action/issues/535)) [[[dependabot[bot]](https://github.com/apps/dependabot)]([https://github.com/[dependabot[bot]](https://github.com/apps/dependabot))]](https://github.com/%5Bdependabot%5Bbot%5D%5D(https://github.com/apps/dependabot))%5D)
> * chore(deps-dev): bump eslint from 9.37.0 to 9.38.0 ([#533](https://github.com/anchore/scan-action/issues/533)) [[[dependabot[bot]](https://github.com/apps/dependabot)]([https://github.com/[dependabot[bot]](https://github.com/apps/dependabot))]](https://github.com/%5Bdependabot%5Bbot%5D%5D(https://github.com/apps/dependabot))%5D)
> * chore(deps-dev): bump lint-staged from 16.2.4 to 16.2.5 ([#534](https://github.com/anchore/scan-action/issues/534)) [[[dependabot[bot]](https://github.com/apps/dependabot)]([https://github.com/[dependabot[bot]](https://github.com/apps/dependabot))]](https://github.com/%5Bdependabot%5Bbot%5D%5D(https://github.com/apps/dependabot))%5D)


Commits

* [`568b89d`](anchore/scan-action@568b89d) chore(deps): update Grype to v0.102.0 ([#536](https://github.com/anchore/scan-action/issues/536))
* [`f8889b1`](anchore/scan-action@f8889b1) chore(deps-dev): bump lint-staged from 16.2.5 to 16.2.6 ([#535](https://github.com/anchore/scan-action/issues/535))
* [`7c6e0bc`](anchore/scan-action@7c6e0bc) chore(deps-dev): bump eslint from 9.37.0 to 9.38.0 ([#533](https://github.com/anchore/scan-action/issues/533))
* [`7891b04`](anchore/scan-action@7891b04) chore(deps-dev): bump lint-staged from 16.2.4 to 16.2.5 ([#534](https://github.com/anchore/scan-action/issues/534))
* See full diff in [compare view](anchore/scan-action@a5605eb...568b89d)
  
Updates `github/codeql-action` from 4.30.9 to 4.31.0
Release notes

*Sourced from [github/codeql-action's releases](https://github.com/github/codeql-action/releases).*

> v4.31.0
> -------
>
> CodeQL Action Changelog
> =======================
>
> See the [releases page](https://github.com/github/codeql-action/releases) for the relevant changes to the CodeQL CLI and language packs.
>
> 4.31.0 - 24 Oct 2025
> --------------------
>
> * Bump minimum CodeQL bundle version to 2.17.6. [#3223](https://github.com/github/codeql-action/pull/3223)
> * When SARIF files are uploaded by the `analyze` or `upload-sarif` actions, the CodeQL Action automatically performs post-processing steps to prepare the data for the upload. Previously, these post-processing steps were only performed before an upload took place. We are now changing this so that the post-processing steps will always be performed, even when the SARIF files are not uploaded. This does not change anything for the `upload-sarif` action. For `analyze`, this may affect Advanced Setup for CodeQL users who specify a value other than `always` for the `upload` input. [#3222](https://github.com/github/codeql-action/pull/3222)
>
> See the full [CHANGELOG.md](https://github.com/github/codeql-action/blob/v4.31.0/CHANGELOG.md) for more information.


Changelog

*Sourced from [github/codeql-action's changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md).*

> CodeQL Action Changelog
> =======================
>
> See the [releases page](https://github.com/github/codeql-action/releases) for the relevant changes to the CodeQL CLI and language packs.
>
> [UNRELEASED]
> ------------
>
> No user facing changes.
>
> 4.31.0 - 24 Oct 2025
> --------------------
>
> * Bump minimum CodeQL bundle version to 2.17.6. [#3223](https://github.com/github/codeql-action/pull/3223)
> * When SARIF files are uploaded by the `analyze` or `upload-sarif` actions, the CodeQL Action automatically performs post-processing steps to prepare the data for the upload. Previously, these post-processing steps were only performed before an upload took place. We are now changing this so that the post-processing steps will always be performed, even when the SARIF files are not uploaded. This does not change anything for the `upload-sarif` action. For `analyze`, this may affect Advanced Setup for CodeQL users who specify a value other than `always` for the `upload` input. [#3222](https://github.com/github/codeql-action/pull/3222)
>
> 4.30.9 - 17 Oct 2025
> --------------------
>
> * Update default CodeQL bundle version to 2.23.3. [#3205](https://github.com/github/codeql-action/pull/3205)
> * Experimental: A new `setup-codeql` action has been added which is similar to `init`, except it only installs the CodeQL CLI and does not initialize a database. Do not use this in production as it is part of an internal experiment and subject to change at any time. [#3204](https://github.com/github/codeql-action/pull/3204)
>
> 4.30.8 - 10 Oct 2025
> --------------------
>
> No user facing changes.
>
> 4.30.7 - 06 Oct 2025
> --------------------
>
> * [v4+ only] The CodeQL Action now runs on Node.js v24. [#3169](https://github.com/github/codeql-action/pull/3169)
>
> 3.30.6 - 02 Oct 2025
> --------------------
>
> * Update default CodeQL bundle version to 2.23.2. [#3168](https://github.com/github/codeql-action/pull/3168)
>
> 3.30.5 - 26 Sep 2025
> --------------------
>
> * We fixed a bug that was introduced in `3.30.4` with `upload-sarif` which resulted in files without a `.sarif` extension not getting uploaded. [#3160](https://github.com/github/codeql-action/pull/3160)
>
> 3.30.4 - 25 Sep 2025
> --------------------
>
> * We have improved the CodeQL Action's ability to validate that the workflow it is used in does not use different versions of the CodeQL Action for different workflow steps. Mixing different versions of the CodeQL Action in the same workflow is unsupported and can lead to unpredictable results. A warning will now be emitted from the `codeql-action/init` step if different versions of the CodeQL Action are detected in the workflow file. Additionally, an error will now be thrown by the other CodeQL Action steps if they load a configuration file that was generated by a different version of the `codeql-action/init` step. [#3099](https://github.com/github/codeql-action/pull/3099) and [#3100](https://github.com/github/codeql-action/pull/3100)
> * We added support for reducing the size of dependency caches for Java analyses, which will reduce cache usage and speed up workflows. This will be enabled automatically at a later time. [#3107](https://github.com/github/codeql-action/pull/3107)
> * You can now run the latest CodeQL nightly bundle by passing `tools: nightly` to the `init` action. In general, the nightly bundle is unstable and we only recommend running it when directed by GitHub staff. [#3130](https://github.com/github/codeql-action/pull/3130)
> * Update default CodeQL bundle version to 2.23.1. [#3118](https://github.com/github/codeql-action/pull/3118)
>
> 3.30.3 - 10 Sep 2025
> --------------------
>
> No user facing changes.
>
> 3.30.2 - 09 Sep 2025
> --------------------
>
> * Fixed a bug which could cause language autodetection to fail. [#3084](https://github.com/github/codeql-action/pull/3084)
> * Experimental: The `quality-queries` input that was added in `3.29.2` as part of an internal experiment is now deprecated and will be removed in an upcoming version of the CodeQL Action. It has been superseded by a new `analysis-kinds` input, which is part of the same internal experiment. Do not use this in production as it is subject to change at any time. [#3064](https://github.com/github/codeql-action/pull/3064)

... (truncated)


Commits

* [`4e94bd1`](github/codeql-action@4e94bd1) Merge pull request [#3235](https://github.com/github/codeql-action/issues/3235) from github/update-v4.31.0-1d36546c1
* [`8f11182`](github/codeql-action@8f11182) Update changelog for v4.31.0
* [`1d36546`](github/codeql-action@1d36546) Merge pull request [#3234](https://github.com/github/codeql-action/issues/3234) from github/mbg/changelog/post-processing
* [`08ada26`](github/codeql-action@08ada26) Add changelog entry for post-processing change
* [`b843cbe`](github/codeql-action@b843cbe) Merge pull request [#3233](https://github.com/github/codeql-action/issues/3233) from github/mbg/getOptionalEnvVar
* [`1ecd563`](github/codeql-action@1ecd563) Use `getOptionalEnvVar` in `writePostProcessedFiles`
* [`e576807`](github/codeql-action@e576807) Merge pull request [#3223](https://github.com/github/codeql-action/issues/3223) from github/henrymercer/bump-minimum
* [`ad35676`](github/codeql-action@ad35676) Add `getOptionalEnvVar` function
* [`d75645b`](github/codeql-action@d75645b) Merge pull request [#3222](https://github.com/github/codeql-action/issues/3222) from github/mbg/upload-lib/post-process
* [`710606c`](github/codeql-action@710606c) Check that `outputPath` is non-empty
* Additional commits viewable in [compare view](github/codeql-action@16140ae...4e94bd1)
  
Updates `ruby/setup-ruby` from 1.265.0 to 1.267.0
Release notes

*Sourced from [ruby/setup-ruby's releases](https://github.com/ruby/setup-ruby/releases).*

> v1.267.0
> --------
>
> What's Changed
> --------------
>
> * Scale bundler install jobs with CPU count up to 8 by [`@​thomasbreland`](https://github.com/thomasbreland) in [ruby/setup-ruby#822](https://github.com/ruby/setup-ruby/pull/822)
>
> New Contributors
> ----------------
>
> * [`@​thomasbreland`](https://github.com/thomasbreland) made their first contribution in [ruby/setup-ruby#822](https://github.com/ruby/setup-ruby/pull/822)
>
> **Full Changelog**: <ruby/setup-ruby@v1.266.0...v1.267.0>
>
> v1.266.0
> --------
>
> What's Changed
> --------------
>
> * Add ruby-3.3.10 by [`@​ruby-builder-bot`](https://github.com/ruby-builder-bot) in [ruby/setup-ruby#819](https://github.com/ruby/setup-ruby/pull/819)
> * Update CRuby releases on Windows by [`@​ruby-builder-bot`](https://github.com/ruby-builder-bot) in [ruby/setup-ruby#821](https://github.com/ruby/setup-ruby/pull/821)
>
> **Full Changelog**: <ruby/setup-ruby@v1.265.0...v1.266.0>


Commits

* [`d5126b9`](ruby/setup-ruby@d5126b9) exec.exec() only accepts strings
* [`274049f`](ruby/setup-ruby@274049f) Use os.availableParallelism() instead of os.cpus().length
* [`a96ff53`](ruby/setup-ruby@a96ff53) Scale bundler install jobs with CPU count up to 8
* [`4ff6f36`](ruby/setup-ruby@4ff6f36) Update CRuby releases on Windows
* [`5375105`](ruby/setup-ruby@5375105) Add ruby-3.3.10
* See full diff in [compare view](ruby/setup-ruby@ab177d4...d5126b9)
  
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
Dependabot commands and options
  
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show  ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore  major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself)
- `@dependabot ignore  minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself)
- `@dependabot ignore ` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore ` will remove all of the ignore conditions of the specified dependency
- `@dependabot unignore  ` will remove the ignore condition of the specified dependency and ignore conditions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants