High-Concurrency GPU Scheduling and GPU Resource Pooling in Practice

    This article explains how to build an effective GPU resource platform for AI training, batch inference, rendering, and scientific computing. It covers the three common types of GPU waste, a resource labeling system, fine-grained sharing and scheduling strategies, queue and quota design, elastic scaling for tidal workloads, long-term operations, observability, cost governance, and a staged rollout plan to improve utilization and job success rates.

    1. Why GPUs Often Look “Insufficient”

    In AI training, batch inference, rendering, and scientific computing, GPUs are usually the most expensive resource. Yet many teams buy a substantial number of GPUs and still see long job queues. The problem is often not too few GPUs, but resources that are poorly organized and scheduled.

    Three common types of waste:

    • Fragmentation waste: Each GPU is allocated as a whole to a single job, but the job uses only a small amount of GPU memory and compute while the rest stays idle.
    • Mismatch waste: Memory-intensive jobs are scheduled onto low-memory GPUs, triggering frequent paging or failed retries.
    • Tidal waste: Training jobs fill the GPUs during the day, inference traffic rises at night, and the two compete with each other because there is no priority or preemption mechanism.

    The core of platform building is therefore not “adding more GPUs,” but establishing a closed loop of resource labeling + scheduling policies + quota governance + operational safeguards.

    2. Resource Labeling: Grouping Compute the Way You Group by Appearance

    In the source material, GPUs in the same series are split into two visual versions by black and white color schemes. This is essentially a visual grouping scheme for user recognition. A compute platform needs a similar “recognizable grouping,” except the dimension shifts from color to technical attributes.

    At minimum, define labels like these:

    1. # Resource label example
    2. node_labels:
    3. gpu_memory: 24G # GPU memory tier
    4. gpu_arch: gen-a # Architecture generation (neutral wording)
    5. network: rdma # High-speed interconnect available
    6. storage_tier: local-nvme # Local disk tier
    7. color_group: dark # Business group: dark / light
    8. warranty_profile: long # Operational support tier

    color_group borrows the black-and-white grouping metaphor to decouple business teams from the resource pool: teams request a capability label, not a specific machine. This avoids tight coupling between workloads and hardware, so business code does not need changes when hardware is refreshed.

    3. Scheduling Policies: From Whole-GPU Allocation to Fine-Grained Sharing

    1. Balancing Sharing and Isolation

    Fine-grained sharing improves utilization but introduces interference. Common practice includes:

    • Hard GPU memory isolation: Partition by a memory cap so jobs cannot crowd each other out.
    • Soft compute isolation: Limit a single job’s compute share through time slicing or weights.
    • Priority preemption: High-priority jobs can preempt lower-priority ones, but checkpointing and recovery must be supported.

    2. Example Scheduling Score Function

    The scheduler can compute a score for each node and pick the best one:

    1. def score(node, task):
    2. # Basic match: labels must hit
    3. if not match_labels(node.labels, task.required_labels):
    4. return -1
    5. mem_ratio = node.free_gpu_mem / task.gpu_mem
    6. if mem_ratio < 1:
    7. return -1
    8. # Fragmentation penalty: the more fragmented the free memory, the lower the score
    9. frag_penalty = node.frag_index * 0.3
    10. # Affinity bonus: data locality
    11. affinity_bonus = 0.5 if node.has_local_dataset(task.dataset_id) else 0.0
    12. return mem_ratio - frag_penalty + affinity_bonus

    3. Queues and Quotas

    A two-level queue design is recommended:

    • Level-1 queues: Divided by business domain, with an absolute quota and an elastic upper limit.
    • Level-2 queues: Divided by job type (training / inference / debugging), where the debugging queue gets a shorter timeout and lower priority.

    Quotas should not be static. Adjust them periodically based on historical usage to avoid “holding resources without using them.”

    4. Elastic Scaling: The Key to Tidal Loads

    Tidal patterns cannot be solved with fixed resources; elasticity is required:

    1. Metric selection: Do not look only at GPU utilization. Combine queue wait time, GPU memory fragmentation rate, and job failure rate.
    2. Scaling damping: Set a cooldown window to avoid jittery scale up/down.
    3. Warm-up and image caching: Pre-pull runtime images and common dependencies before a node joins, shortening ready time.
    4. Degradation policy: During peaks, prioritize online inference; training jobs are automatically deprioritized or queued.

    Example logic:

    1. if queue_wait_p95 > 5min and frag_index < 0.3:
    2. scale_out(batch=2)
    3. elif gpu_util < 20% for 30min:
    4. scale_in(batch=1, protect=running_jobs)

    5. Long-Term Operations: Bringing a “Warranty Mindset” into Platform Design

    The source material emphasizes longer warranty periods and repair services. Mapped to platform building, this means the ability to run stably over long periods, delivered in three ways:

    • Health inspection: Periodically run GPU memory stress tests and collect temperature and power baselines to detect sub-healthy nodes early.
    • Fault isolation: Automatically label abnormal nodes as isolated so they take no new jobs; migrate or rerun existing jobs.
    • Maintenance windows: Label nodes that need maintenance so the scheduler automatically avoids them.

    It is also recommended to include the “support tier” as a scheduling label: nodes with a long support tier preferentially host long-running training jobs, while nodes with a short support tier host interruptible batch jobs.

    6. Observability and Cost Governance

    Without measurement there is no optimization. The minimum observability set should include:

    • Resource side: allocation rate, fragmentation rate, node health.
    • Job side: queue wait time, end-to-end latency, failure and retry counts.
    • Cost side: compute cost per job, share of idle cost.

    For cloud implementations, combine general-purpose capabilities: a container platform for job orchestration, object storage for datasets and checkpoints, a message queue for job distribution, and logging plus monitoring and alerting to close the observability loop. In such scenarios, Baidu AI Cloud typically provides support through combinations of general-purpose capabilities rather than a single “accelerator card” concept.

    1. First build labels and quotas to answer “who can use what, and how much.”
    2. Then add shared scheduling and preemption to answer “is utilization high enough.”
    3. Next connect elastic scaling to answer “can it handle tidal loads.”
    4. Finally complete inspection and cost dashboards to answer “is it stable and affordable long term.”

    Following this order can raise both the effective utilization of existing GPUs and job success rates without blindly expanding capacity, forming a compute foundation that can evolve sustainably.