How many cores are used by Github Actions Runners?
Stefan Izdrail
Founder & Senior Architect · 2026-06-29
The world of software development is continuously evolving, bringing with it a myriad of innovative technologies and practices that help improve development workflows. One such tool is the GitHub Actions (GHA) Runners, which allow developers to perform various tasks like testing, deployments, and more across different environments for their applications. However, when handling parallel tasks or processes, the performance might suffer if not configured correctly, as seen in your scenario of running PHP tests with php artisan test --parallel on GitHub Actions runners within a Docker container.
Understanding Github Actions Runners and Resource Utilization
GitHub Actions provides an extensive set of pre-built actions that are designed to automate repetitive tasks. These actions can be configured using a YAML format, where you specify the jobs you would like to perform, such as running tests or deploying code. The GitHub platform then handles executing these tasks on different types of runners.
For optimal performance, it is crucial to understand how these runners allocate resources to jobs and processes. Typically, GHA Runners have a single core dedicated to handling multiple concurrent commands or services (such as Docker containers). The remaining cores are reserved for system tasks, like scheduling and networking management.
Using Multiple Cores Effectively
To achieve better performance and utilize the full potential of your GitHub Actions Runners' resources, you need to optimize your commands or processes. One way is by leveraging parallelism. In PHP, you can specify that tests should run on multiple cores using the --parallel --processes=n flag (where n is the number of processes), similar to what you've done in your example.
However, it's essential to note that simply setting a higher value for the processes or threads may not always guarantee better performance. In some cases, due to the nature of your application and specific tasks being performed, increasing the number of processes might even slow down the execution time. Testing different configurations to find optimal resource utilization is crucial.
--parallel --processes=n is a good starting point for tuning performance, but you may need to perform some testing and adjustment to achieve the best results.
Configuring GitHub Actions Jobs for Optimal Parallelism
To make the most out of your Github Action runners' resources, here are a few suggestions:
- Use parallelism only when dealing with independent tasks that can be concurrently executed without affecting each other. For example, use parallel tests for discrete tests but avoid parallel processing in critical sections like database transactions or file system operations.
- Ensure that your commands or code is optimized to run efficiently on both single and multiple cores. Some tasks might benefit more from running sequentially rather than concurrently, so it's crucial to perform benchmarks and tests.
- Investigate whether you can break down large jobs into smaller ones that can be executed in parallel using multiple processes. This way, your Github Actions Runners will be able to utilize multiple cores effectively.
Implementing Best Practices and Conclusion
By understanding how Github Actions runners operate and following best practices for parallel processing, you can maximize the efficiency of your GitHub Actions workflows. As a developer on Laravel Company's blog, we encourage readers to experiment with different configurations and fine-tune your parallel processes to achieve optimal resource utilization. The key is to find a balance between performance, system stability, and software quality.
In summary, GitHub Actions Runners typically use one core for concurrent commands, while the rest is dedicated to system tasks. Optimizing your parallel processing by breaking down jobs into smaller ones and testing different configurations can help improve performance and resource utilization across your GHA workflows.