All posts
Development Log 2 min read

How to share a build machine between busy projects

A five-slot runner can serve more than one project. Start with a project limit and see how its queue behaves alongside the other work.

Imagine one build machine serving an API and a web app. The API has three review and fix jobs queued. The web app has two eligible jobs ready to go. The runner can handle five jobs, but you want the API to use at most one slot so it has room for other work. Increasing the machine’s total capacity still gives the API queue room to grow into that capacity.

Work through the queue before setting a limit

Give the API a limit of one on the shared runner. The runner can claim one API job. Both web jobs can run, assuming they’re eligible and the web app’s own limits allow them. You’ll have three jobs running and two slots open. The other API jobs stay queued until their turn comes. If the web team adds more eligible work, that work can use the open capacity.

This is worth checking before you tune the machine. An idle slot can be the expected outcome of protecting capacity for another project. When a project’s limit is the reason it’s waiting, adding CPU to the runner won’t change what the scheduler can claim.

How Autop limits one project on a shared runner

On November 22, the request for Autop was to limit one project to one slot on a five-slot runner. Autop already had a limit for the whole runner and a separate project-wide cap for implementation jobs. This needed a limit for all regular work from one project on one particular runner.

In Autop, a workspace owner sets this on the project’s Runners panel for the individual machine. It covers regular jobs, including reviews and fixes. Planning turns and runner maintenance use their existing paths. If you need to lower the limit while reviews are running, the new limit applies to future claims and the current jobs finish.

Topics

Get new posts by email