Repository navigation
perf(fleet): 60 s cello lease and rebalance intervals for idle fleets - #211
Merged
Merged
Conversation
- Awake-but-idle fleets cost ~1.81M R2 Class A ops/month (~$8) doing nothing: node-lease PUT every TTL/3 (~3.3s at the 10s default) plus a capacity-sample GET+PUT every rebalance interval (5s default) with a LIST nodes/ scan on each refresh. - Set CELLO_TTL_MS=60000 and CELLO_REBALANCE_INTERVAL_MS=60000 (what Noite runs): renew every 20s, sample every 60s, cutting idle ops to ~0.3-0.45M/month. - Safe for single-node fleets: SIGTERM defaults to Handoff, which releases every ownership record at once (no TTL wait); same-node restarts replace their own lease immediately (singleton key); deploy pickup is POST /reload + CELLO_DEPLOY_POLL_S, not the rebalance tick. Crash-recovery worst case grows 10s -> ~60s (successor waits out the dead lease).
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 37 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Idle cost: an awake-but-idle app fleet (
CELLO_DURABILITY=bucket) issues1.81M R2 Class A ops/month ($8) doing nothing. This setsCELLO_TTL_MS=60000andCELLO_REBALANCE_INTERVAL_MS=60000(what Noite runs) in the fleet env, cutting that to ~0.3-0.45M/month. Crash-recovery worst case grows 10 s -> ~60 s; every graceful path is unaffected (evidence below).Evidence (all at the pinned Cello v0.3.2,
docker/DockerfileCELLO_VERSION=0.3.2)CELLO_TTL_MS(default 10000)crates/cello/main/cli.rs:387, read atcrates/cello/actor.rs:2561crates/logic/lib.rshold_node_lease:renew_after = (spec.ttl_ms / 3).max(1); fence timer at anchor+TTL)CELLO_REBALANCE_INTERVAL_MS(default 5000, 0 disables)crates/cello/main.rs:4072(DEFAULT_REBALANCE_INTERVAL_MS), read atmain.rs:4434; also sets the shared fleet-sample interval (main.rs:4439)fleet/capacity-v1.jsonevery tick, and when stale claim-PUT +LIST nodes/+ lease GETs + sample PUT (ownership_store.rs:read_or_claim_capacity_sample)generation.rs:91-94(CELLO_DEPLOY_POLL_S, default 30; Outer sets 30), plus Outer POSTs /reload after every deployfleet_reads(&peers…)per sample (main.rs:5254+); single peer is always currentFailure modes (single-node-per-app fleets)
ShutdownMode::Handoff(main.rs:5604-5605;/shutdowndefaults to Handoff,main.rs:3518-3526); Handoff means "release every owner record so another node can take over without waiting for the node lease to expire" (actor.rs:606-607). Node-lease records are never deleted, only ownership records — and those release at once. No wake-latency or deploy-downtime impact. Residual edge (pre-existing): releases are bounded by the drain deadline, so a wedged store at shutdown can still leave the successor waiting out the lease — now up to ~60 s instead of ~10 s.manager.rs:376), so the node id is stable; a restart replaces its own lease immediately — "a configured node id is a singleton key: restarting that node replaces its prior process generation immediately" (logic/lib.rsinitial-acquire path). No wait.now_msreachesexpires_ms(logic/lib.rs:1028+); the successor then takes over (with the dead-owner log-recovery interlock,apply_node_lease_result). Worst case grows 10 s -> ~60 s, plus log recovery (1 s backoff base).Ops estimate (30-day month = 2,592,000 s, Class A)
Checks
cargo fmt --all --check: cleancargo clippy --all-targets --locked -- -D warnings: clean (one pre-existing unused-dep warning)cargo test --locked -p outer --lib -- fleet::: 74 passed, 0 failedweb/docs/agents/platform/*andweb/docs/deploy/*state no lease/failover timing — no doc change needed.