mirror of
https://github.com/kvcache-ai/AgentENV.git
synced 2026-11-05 01:17:36 +00:00
[PR #68] feat(scheduler): add resource-bounded grouped round-robin scheduling #154
Labels
No labels
bug
documentation
enhancement
enhancement
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/AgentENV#154
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/kvcache-ai/AgentENV/pull/68
Author: @shudorcl
Created: 7/29/2026
Status: 🔄 Open
Base:
main← Head:feat/grouped-locality-scheduling📝 Commits (8)
c46bf05feat(gateway): propagate template scheduling identityecce76brefactor(scheduler): derive current scheduling status41c67ecfeat(scheduler): add resource-bounded locality strategy742aa2dfeat(scheduler): configure locality group limits59e8787refactor(scheduler): rename locality strategyf2b8e65refactor(scheduler): inline group fullness checkbcce052test(scheduler): cover scheduling snapshot derivation33ea518fix(scheduler): bound omitted cold-start resources📊 Changes
14 files changed (+929 additions, -33 deletions)
View changed files
📝
services/README.md(+25 -2)📝
services/api/proto/scheduler.pb.go(+15 -3)📝
services/api/proto/scheduler.proto(+3 -0)📝
services/gateway/internal/schedule_hint.go(+3 -1)📝
services/gateway/internal/schedule_hint_test.go(+22 -0)📝
services/scheduler/cmd/main.go(+8 -1)➕
services/scheduler/internal/grouped_round_robin_strategy_test.go(+299 -0)📝
services/scheduler/internal/node_registry.go(+29 -22)📝
services/scheduler/internal/node_registry_test.go(+109 -0)📝
services/scheduler/internal/service.go(+2 -2)📝
services/scheduler/internal/service_test.go(+46 -0)📝
services/scheduler/internal/strategy.go(+245 -2)📝
services/shared/config/config.go(+41 -0)📝
services/shared/config/config_test.go(+82 -0)📄 Description
What
This PR adds an opt-in
grouped_round_robinscheduling strategy as a bounded workload-affinity building block for #15. Requests with the same rootfs image reference or exact template reference stay on one eligible READY node until the group's sandbox, CPU, or memory budget is reached, after which a new group is assigned through global round-robin.The Gateway now propagates
templateIDthrough the internal scheduling hint, scheduling snapshots derive current node status from discovery state and heartbeat TTL, and the new strategy is covered by configuration, documentation, and focused tests.Why
Plain round-robin can scatter repeated workloads across nodes and repeatedly warm the same image or template artifacts. Grouped placement improves the opportunity for local cache reuse while bounding concentration and preserving the existing node resource filter.
Related issue
Refs #15
This PR provides request-identity affinity but does not close the broader cache-aware scheduling issue.
Scope and non-goals
In scope: grouped placement by the first rootfs image or exact template reference, configurable group budgets, fresh READY-node enforcement, bounded in-memory group state, gateway hint propagation, and operator documentation.
Non-goals: inspecting or scoring actual node cache or P2P inventory, resolving mutable image tags or template aliases, considering attached-drive identities, adding projected hard-capacity admission, or persisting and reconciling group state across scheduler restarts.
Design and behavior changes
Each workload identity has at most one open group. Requests reuse its node while the request fits the configured group budget; otherwise the group closes and the request starts a new group on the next eligible node. New groups for all identities share one stable global round-robin cursor, while missing or oversized identities use a separate round-robin fallback.
Placement accounting is serialized and updated during scheduling so concurrent bursts cannot overfill an open group while heartbeat metrics lag. Open state is capped at 10,000 keys with LRU eviction. Template requests do not carry CPU or memory values, so their groups use the sandbox-count limit only.
Compatibility and operations
NewSandboxHint.template_idfield 2, which is wire-compatible with mixed Gateway and Scheduler versions.round_robin. Selectinggrouped_round_robinrequiresscheduler.grouped_round_robin.max_sandbox_count > 0; CPU and memory group limits are optional. Equivalent environment overrides are documented.Validation
make fmtmake clippymake test-unitmake -C services test(required whenservices/changes)maketargetCommands and results:
Local
make -C services fmt-checkreports unrelated CRLF files because this WSL checkout usescore.autocrlf=true; the same commit passesfmt-checkin Services CI.Skipped checks and reasons:
Risks and reviewer notes
services/scheduler/internal/strategy.go,services/gateway/internal/schedule_hint.go,services/scheduler/internal/node_registry.go, andservices/shared/config/config.go.Checklist
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.