Queue server calculations beyond PLANNING_WORKERS #323

Closed
opened 2026-10-28 19:04:13 +01:00 by nessar · 0 comments
Owner

Parent

#319

What to build

When the server is busy, a new calculation waits its turn instead of slowing every running calculation down. At most PLANNING_WORKERS calculations run at once. Others wait in FIFO order, and the server sends a heartbeat every second while they wait, so the client's 30-second liveness timer does not expire. Cancel, or closing the socket, removes a waiting calculation. A running slot is freed by the job's terminal message, or by the socket closing, whichever comes first. A client that keeps an idle socket open therefore does not hold a core. No queue position is shown.

If PLANNING_WORKERS is unset, it defaults to half of navigator.hardwareConcurrency. Mark this with a shortcut: comment: the default assumes two threads per core, and throughput was measured to stop growing at physical cores. The production Compose file drops the one-CPU and 512 MB limits, caps memory at 8 GB and exposes PLANNING_WORKERS.

Acceptance criteria

  • With PLANNING_WORKERS=1, a second calculation waits, receives heartbeats, and starts when the first finishes; three or more start in arrival order.
  • A calculation that waits longer than 30 seconds still completes, without a worker error on the client.
  • Closing a waiting socket removes it from the queue. Freeing a running slot, by a terminal message or by a socket close, starts the next waiting calculation.
  • The production Compose file has no one-CPU limit, caps memory at 8 GB, and documents PLANNING_WORKERS.

Blocked by

## Parent #319 ## What to build When the server is busy, a new calculation waits its turn instead of slowing every running calculation down. At most `PLANNING_WORKERS` calculations run at once. Others wait in FIFO order, and the server sends a heartbeat every second while they wait, so the client's 30-second liveness timer does not expire. Cancel, or closing the socket, removes a waiting calculation. A running slot is freed by the job's terminal message, or by the socket closing, whichever comes first. A client that keeps an idle socket open therefore does not hold a core. No queue position is shown. If `PLANNING_WORKERS` is unset, it defaults to half of `navigator.hardwareConcurrency`. Mark this with a `shortcut:` comment: the default assumes two threads per core, and throughput was measured to stop growing at physical cores. The production Compose file drops the one-CPU and 512 MB limits, caps memory at 8 GB and exposes `PLANNING_WORKERS`. ## Acceptance criteria - [ ] With `PLANNING_WORKERS=1`, a second calculation waits, receives heartbeats, and starts when the first finishes; three or more start in arrival order. - [ ] A calculation that waits longer than 30 seconds still completes, without a worker error on the client. - [ ] Closing a waiting socket removes it from the queue. Freeing a running slot, by a terminal message or by a socket close, starts the next waiting calculation. - [ ] The production Compose file has no one-CPU limit, caps memory at 8 GB, and documents `PLANNING_WORKERS`. ## Blocked by - #320
nessar added the ready-for-agent label 2026-10-28 19:04:13 +01:00
nessar added a new dependency 2026-10-28 19:04:31 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: nessar/vac-optimizer#323