Count heavy jobs, not agents
An agent that is reading files or waiting for its model uses almost no CPU, and far less memory than the test suites it starts. The cost comes in bursts, when it checks its work: a full test suite, a type check of the whole project, a production build. Many test runners and build tools start a pool of workers for those, so one suite can keep most cores busy by itself.
That changes the question. With 16 GB of memory, the limit is usually not how many agents are open. It is how many heavy jobs run at the same moment, and how much memory each of those holds. Two agents whose suites always overlap can be worse than five whose suites take turns.
The defaults
DeployOnTime's machine queue starts with settings that suit a laptop or a small desktop:
| Setting | Default | What it does |
|---|---|---|
| slots | 2 | At most 2 heavy jobs run at once; the rest wait their turn. |
| health.minFreeMemPct | 20 | A job waits while less than 20% of memory is free. |
| health.minFreeDiskGB | 10 | A job waits while less than 10 GB of disk is free. |
| health.loadPerCore | 1.0 | A job waits while the load per core is above this and the CPU is at least 90% busy now. |
| maxWaitMin | 60 | A job leaves the line after 60 minutes with exit 75. |
The gate is checked only before a job starts. A running job is never stopped because the computer got busy.
A method to find your number
- Route every heavy command through the queue. Run
dotime-queue setup --writein each project, so the agents start their suites and builds withdotime-queue run. - Work as usual for a few days with as many agents as you like. The slots keep the machine usable while you measure.
- Read the history. It shows per project how long jobs waited and which gate held them.
- Decide from what held the jobs. Waits on a free slot while memory and CPU stay calm mean you can try one more slot. Waits on memory or load mean the machine is already full, and more slots would only make each run slower.
dotime-queue history --days 7dotime-queue statushistory separates three kinds of waiting: sum, all waiting added up; clock, how long the line was not empty; and clock with no job running, how long jobs waited while none ran, for example because the health gate was shut.
Tune slots and the gate
Settings live in ~/.dotime/config.json. The file is optional; write only the keys you change. To allow a third heavy job at once:
{ "slots": 3 }On a machine with little free disk or memory, where the gate stays shut, lower its limits instead:
{ "health": { "minFreeMemPct": 5, "minFreeDiskGB": 2 } }- Change one value at a time, then read the history again.
- The settings apply to every agent that uses the state folder, so one agent cannot loosen a limit for the others.
- A new command gets the limit its kind has learned in that project, as short as 10 minutes, or 30 minutes until the kind has five passed runs. Give a long first run
--max-run <min>.
Every key is on the settings page.
What was measured
The project publishes one measurement. On a Mac, 4 agents start the same test suite at the same moment. Each suite runs 5 threads and holds 2 GB, and together they ask for twice the CPU there is. Through the queue, at most 2 suites run together. Three runs each way:
- Tests that failed on the first try: 400 of 400 started directly, 0 of 400 through the queue, in every run.
- Time until every agent had a green run: 373 s in one direct run, and in the other two some agents were still red after 8 runs (447 s and 469 s); through the queue, 57 to 58 s.
- Suite runs: 25 to 32 started directly, 4 through the queue.