Skip to content

DRU-1094 -- One cloud's burst cannot take every sandbox host on a cell - #93

Merged
czpython merged 1 commit into
mainfrom
paulo/dru-1094-one-clouds-burst-cannot-take-every-sandbox
Nov 6, 2026
Merged

czpython merged 1 commit into
mainfrom
paulo/dru-1094-one-clouds-burst-cannot-take-every-sandbox

Conversation

@czpython

@czpython czpython commented Nov 6, 2026 •

Copy link
Copy Markdown
Owner

HOST_LIMIT_PER_SERVICE_ACCOUNT sets the most live hosts per service account, beside HOST_LIMITS per provider. A caller that creates hosts with its own service account now waits on its own limit, so one caller's burst cannot take every host the provider allows.

  • HostService.get_or_create_host checks it before it claims a warm host or creates one, so a claim counts like a create. The check takes an advisory lock keyed by the service account, and the claim or the insert commits the transaction that holds it, so two creates of one account cannot both pass the count.
  • A live host is not in error and has not expired, the count the provider limit uses. Both limits now count through _count_live_hosts, which takes the lock first. The provider's lock key is now provider:<name>, apart from service_account:<name>.
  • At the limit, POST /hosts answers 503 with CAPACITY and Retry-After, as at the provider limit. The admin key has no service account limit. Unset means no limit.
  • docs/api.md and the settings table in docs/deploy.md name the setting.
  • hosts/service.py imports hosts.exceptions and providers.exceptions as modules, as the house rules ask of a touched file.

@czpython
czpython force-pushed the paulo/dru-1094-one-clouds-burst-cannot-take-every-sandbox branch from 219c329 to b2fda07 Compare November 6, 2026 20:42
@czpython
czpython merged commit 56ffe38 into main Nov 6, 2026
7 checks passed
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