Skip to content

Keep a free slot on full nodes - #810

Merged
SaladDay merged 3 commits into
mainfrom
free-slot
Oct 21, 2026
Merged

SaladDay merged 3 commits into
mainfrom
free-slot

Conversation

@SaladDay

@SaladDay SaladDay commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

What users see

A new hosted Session no longer waits for an idle allocation to suspend when its node is full. Core keeps one active slot free per node: an allocation idle for at least 2 minutes on a node with no free active slot but a free retained slot may be suspended without waiting demand. The suspended Session's next Turn resumes it (about 1.9 s). The idle timeout (idle_seconds, default 300 s) is unchanged; if it is shorter than 2 minutes the ordinary timeout already applies.

Changes

  • SetCompute also allows running to quiescing when the allocation has been idle for 2 minutes (freeSlotIdle), its node passes the same deployment and node checks as demand suspension (nodes mode, not resetting, same installation, online, Active >= MaxActive), the node has a free retained slot (a suspended allocation keeps its retained slot, so without one the freed active slot admits no Session), and no reclamation is in flight on that node.
  • The shared checks moved into fullNode; SetCompute loads the suspension demand once for both rules, and the demand path is otherwise unchanged. Busy and wake-requested allocations are still refused.
  • docs/sandbox-provider.md and its Chinese mirror describe the rule in the Suspension paragraph and the Timeouts and limits table.

Measured

Before this change a new Session on a full node waited for a suspend of 5.5–7.8 s (median 6.2 s over 15 runs). Resuming the suspended Session takes about 1.9 s.

Tests

TestPressureSuspensionRequiresUsefulCapacity gains a full node idle past 2 minutes (allowed) a node with a free slot at the same idle (ErrNotIdle) and a full node whose retained slots are full (ErrNotIdle); the existing 1-minute no-demand case still returns ErrNotIdle. Ran go test ./internal/persistence/postgres/deploymentpg -run TestPressureSuspension and go vet ./... for services/core.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

The freed active slot admits no Session when the node's retained slots are
full, so the free-slot rule now also needs a free retained slot. SetCompute
loads the suspension demand once for both checks.
@SaladDay
SaladDay merged commit a449ab7 into main Oct 21, 2026
19 checks passed
@SaladDay
SaladDay deleted the free-slot branch October 21, 2026 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant