14

Question related to the topic of Parallelism in Self-Hosted Runners:

One self-hosted runner can only run one job at a time, when no available runners are idle, the subsequent jobs will be in queueing until have available runners are idle.

Can I possibly achieve parallelism by running multiple self-hosted runners on the same machine with multiple CPUs?

In the GitHub Actions - Getting Started - Usage Limits I found:

The number of concurrent jobs you can run in your account depends on your GitHub plan, as indicated in the following table. If exceeded, any additional jobs are queued. There are no concurrency limits for self-hosted runners.

But I'm not sure how to understand this in the context of multi-core machines.

Tomasz Bartkowiak
  • 12,154
  • 4
  • 57
  • 62

1 Answers1

13

One runner can only run one job at the time. That is independent of how many cores that machine has.

However, you can install and run multiple runners on the same machine.

When you go through the setup wizard, you will be asked for a directory. If you used /home/github/action-runner for the first one, maybe use /home/github/action-runner-2 for the second directory. They will have completely different workspaces.

Give the additional runner a unique name.

If you are managing the services with systemd, a final step is to create a second systemd unit file for the additional run, with a unique service name and a WorkingDirectory= directory that matches the one you used above:

# for example, this might be /etc/systemd/system/ actions.runner.MyCorp.ci-2.service
[Unit]
Description=GitHub Actions Runner (RideAmigosCorp.ci-2)
After=network.target

[Service]
ExecStart=/home/github/action-runner/runsvc.sh
User=github
# The working directory here must match the one during setup
WorkingDirectory=/home/github/action-runner-2
KillMode=process
KillSignal=SIGTERM
TimeoutStopSec=5min

[Install]
WantedBy=multi-user.target
Mark Stosberg
  • 12,961
  • 6
  • 44
  • 49
Peter Fortuin
  • 5,041
  • 8
  • 41
  • 69
  • 5
    Do you share a _work directory for the repos between the runners? If I have multiple jobs in one script, I want them to use both runners, but they need to share the files generated by each runner. – Airn5475 Dec 09 '20 at 16:15
  • Posted my own question to find more help on this: https://stackoverflow.com/questions/70772623/use-multiple-github-self-hosted-runners-in-the-same-workflow – Airn5475 Jan 19 '22 at 14:43
  • @Airn5475 Share which files? And why?? – user18619318 Jun 28 '22 at 13:28