关于在多核机器部署多GitHub Actions自托管Runner实现并行的技术问询
Absolutely! Running multiple self-hosted runners on a single multi-core machine is a valid and recommended way to make the most of your hardware's parallel processing capabilities. Let’s break down your questions clearly:
1. Yes, you can run multiple self-hosted runners on the same machine
Each self-hosted runner operates as an independent process (or service, depending on your OS), so you can register multiple instances on the same hardware. Here’s what you need to keep in mind:
- Unique working directories: When registering each runner, specify a distinct
--workdirectory to avoid file conflicts between parallel jobs. For example:# First runner setup ./config.sh --url https://github.com/your-org/your-repo --token YOUR_REG_TOKEN --work "_work_runner1" # Second runner setup ./config.sh --url https://github.com/your-org/your-repo --token YOUR_REG_TOKEN --work "_work_runner2" - Distinct names (optional but helpful): Use the
--nameflag to give each runner a unique identifier, making it easier to track their activity in GitHub’s UI. - Align with hardware resources: Match the number of runners to your machine’s CPU cores and memory. A good starting point is 1 runner per core (or slightly fewer if your jobs are resource-heavy) to avoid overloading the system.
2. Understanding self-hosted runner concurrency limits
The note you saw about "no concurrency limits for self-hosted runners" is straightforward:
- GitHub’s plan-based concurrency limits only apply to GitHub-hosted runners. These limits restrict how many jobs you can run simultaneously on GitHub’s managed infrastructure.
- For self-hosted runners, GitHub does not impose any hard limits on how many runners you can operate or how many parallel jobs you can run. The only constraints are your machine’s own hardware resources (CPU, memory, disk I/O) and any explicit concurrency controls you’ve set in your workflows (like
concurrency: group: ...).
So if you have an 8-core machine, you could run 8 self-hosted runners—each handling one job at a time—allowing 8 jobs to execute in parallel. GitHub won’t queue these jobs due to concurrency limits (unless your workflow has intentional restrictions).
Key considerations
- Monitor resource usage: Keep tabs on CPU, memory, and disk usage to avoid overloading your machine. If jobs start failing or slowing down, reduce the number of runners.
- Isolate job environments: Separate working directories prevent accidental file overwrites between jobs running on different runners.
- OS-specific setup: On Windows, each runner registers as a separate Windows Service; on Linux/macOS, you can manage runners as systemd services or background processes.
内容的提问来源于stack exchange,提问作者Tomasz Bartkowiak

