This design proposes Sherlock Scheduler, a GPU-centric scheduling layer optimized for multi-tenant ML environments (e.g., training, fine-tuning, inference). It builds on Kubernetes (K8s) extensions like Volcano or Kueue but adds ML-specific primitives: gang scheduling (all GPUs for a job or none), elastic scaling for variable parallelism, and preemption tuned for checkpointing-heavy ML jobs.
Key goals:
Quotas: Enforce resource budgets (GPU-time, memory) per tenant/namespace to prevent starvation.
Priorities: Multi-level queuing with fair-share and urgency signals.
Preemption: Graceful (soft) or aggressive (hard) eviction, minimizing job slowdowns via checkpoints.
Assumptions:
Runs on K8s clusters with NVIDIA GPUs (via device plugins).
Jobs submit via CRDs (e.g., MLJob with replicas, gpuPerReplica).
Metrics from DCGM/NVIDIA exporter for real-time GPU usage.
Architecture
code
[Users/Tenants] --> [API Server (CRDs: MLJob, Quota, PriorityClass)]
|
v
[Admission Controller] --> Quota Check --> Priority Assignment
|
v
[Sherlock Scheduler] <--> [Etcd/State Store] <--> [Resource Tracker (GPU Metrics)]
| |
| v
v [Preemptor/Enforcer]
[ kube-scheduler (CPU/Pod Binding) ] --> [Kubelet + NVIDIA Runtime]
Core Loop: Watch for Pending MLJobs → Feasibility check → Bind Pods → Monitor → Preempt if needed.
Plugins: Extensible (e.g., binpack, diversify for GPU placement).
Resource Model
GPU as Composite Resource:
Resource
Unit
Description
nvidia.com/gpu
count
Number of GPUs (fractional via MIG/Time-slicing).
nvidia.com/memory
MiB
VRAM allocation.
nvidia.com/compute
FLOPs/sec
Utilization (tracked via DCGM).
gpu-time
Seconds
Cumulative usage for quotas.
Job Specs (MLJob CRD excerpt):
yaml
apiVersion: ml.trailblazerlabs.com/v1
kind: MLJob
spec:
priorityClass: high # Maps to numeric priority
quotaRef: team-alpha # Namespace-scoped quota
replicas: 8 # Gang size (all GPUs or pending)
gpuPerReplica: 1
minAvailable: 4 # Elastic scaling
checkpointPath: s3://... # For preemption recovery
Quota System
Hierarchical quotas (Cluster > Namespace > User):
Types:
Hard: Absolute limit (e.g., 10 GPUs max).
Bursty: Sustained (80%) + peak (100%) over time windows (e.g., 1h/24h).