Repository navigation
Conversation
|
/ok to test 859406f |
|
Label |
|
if one workspace stays busy and has many sandboxes setting up, each one costs 500 ms before it's skipped. For example, 50 sandboxes make a pass take about 25 seconds. Should the scan skip the rest of that workspace after its first timeout? |
|
with a steady stream of writers, an overdue sandbox could be skipped on every pass, and nothing bounds that. The only signal is a warning log. |
The provisioning-deadline scan takes each provisioning sandbox's local S(global) S(workspace) X(sandbox) keys in ascending key order and waited for them with no deadline. When a sandbox's key sorts before its workspace's key, the scan held X(sandbox) while it waited behind a provider or profile writer, so start, stop and delete for that sandbox waited for the writer too. In the other order, the scan held S(workspace) while it waited for a busy sandbox, and provider writers on that workspace queued behind it. Either way the rest of the pass waited as well. Each pass now has a 500 ms budget for waiting on these keys. A sandbox whose keys stay busy is skipped and picked up on the next pass a second later. Once the budget is spent, the rest of the pass only takes keys that are free when it reaches them, so a busy workspace or global key costs one wait per pass rather than one per sandbox. The local acquisition is cancel-safe, so giving up releases the keys it already took. Skips log at debug and count in the new openshell_server_provisioning_deadline_skips_total counter, labeled by whether the sandbox was already past its deadline. A steady rate of delayed expiries can then be alerted on without a warning every pass. The gateway metrics page and the cluster debugging skill describe it. The test that pinned the old wait is replaced by tests for both key orders: a lifecycle lock or a provider writer proceeds and the scan finishes while the other side holds its key, the skipped sandbox is untouched and expires once the writer releases, and a skip doesn't end the pass for other sandboxes. Another test checks that sandboxes behind one busy workspace share a single wait. Part of NVIDIA#4307 Closes NVIDIA#4547 Signed-off-by: Emilien Macchi <emacchi@redhat.com>
859406f to
098b69c
Compare
Both are in 098b69c ( |
|
/ok to test 098b69c |
Summary
The provisioning-deadline scan waited with no deadline for each sandbox's local mutation keys, so a slow provider or profile write could stall lifecycle operations on an unrelated sandbox, or stall provider writes behind a busy sandbox. The scan now waits at most 500 ms per pass and picks a busy sandbox up on the next pass.
Related Issue
Closes #4547 (needs
state:acceptedfor the issue acceptance check)Part of #4307
Changes
reconcile_provisioning_deadlinesgives each pass a 500 ms lock-wait budget and skips a sandbox whose keys stay busy. Once the budget is spent, the rest of the pass only takes keys that are free, so a busy workspace or global key costs one wait per pass, not one per sandbox. The acquisition is cancel-safe, so a skip releases the keys it took.openshell_server_provisioning_deadline_skips_total{overdue}.debug-openshell-clusterskill, the lock table inmutation_lock.rs, and thelock_sandbox_local_in_workspacedoc comment.refresh_provisioning_deadlineand conflicts textually with this PR. The lock acquisition stays in the scan loop there, so keep the per-pass budget and skip around it.Testing
mise run rust:lint,rust:format:check,cargo test -p openshell-server --features test-supportandmise run test:rust:postgrespass.Checklist