Chương 49: GKE AI/ML Infrastructure — GPU, TPU, Large-Scale Workloads
Tại sao chương này quan trọng
AI/ML là dominant workload pattern trên cloud ngày nay. GPU và TPU không phải là "compute như bình thường" — chúng có hành vi khác lạ:
- Scheduling phức tạp: Device plugins, isolation strategies (MIG, time-slicing), gang scheduling — không thể chỉ yêu cầu
nvidia.com/gpu=1mà hy vọng là xong - Communication là병목: Inter-GPU traffic (NCCL, GPUDirect) có throughput bằng 10-100x so với Ethernet thường — nếu bỏ lỡ, training 100 GPU bị drag xuống tốc độ 10 GPU
- Cost bất cân xứng: GPU $10-15/giờ. Với preemption, multiplexing, phải hiểu trade-offs giữa utilization vs latency
- Topology ràng buộc: TPU phải scale nguyên trạng (0 hoặc
4x4x4topology), không thể thêm 1 GPU vào cluster 8-GPU như CPU
Chương này dạy mental model chính xác để design, deploy, debug AI/ML infrastructure trên GKE.
Điều kiện tiên quyết
- Chương 6 (GKE Pod Networking, Service Networking) — hiểu network plumbing
- Chương 9 (GKE Node Architecture, Taints/Tolerations, Affinity) — hiểu node scheduling
- Kubernetes fundamentals — workloads, device plugins (cơ bản)
- Accelerator fundamentals — GPU là gì, TPU là gì, vì sao chúng có resource model khác
Các subtopic
1. GPU Node Pool Architecture & Device Plugin
Học được gì:
- Cơ chế GPU node pool được tạo và managed trong GKE
- NVIDIA device plugin quản lý GPU resources như thế nào
- GKE GPU driver installation — tự động vs manual
- Constraints: quota, hardware availability, region limitations
- Mental model: GPU không phải "generic resource" mà là managed device with driver+plugin
Độ dài: ~3500 từ
2. GPU Memory Strategies — MIG, Time-Slicing, Tradeoffs
Học được gì:
- Multi-Instance GPU (MIG) — partitioning model, each partition isolated
- GPU Time-Slicing — instruction-level preemption, fair scheduling
- Comparison: MIG vs Time-Slicing vs NVIDIA MPS
- Constraints: memory enforcement, isolation gaps, performance impact
- When to use each strategy (cost vs latency vs utilization)
- Failure modes: memory pressure, context-switching overhead
Độ dài: ~4000 từ
3. TPU Architecture — Types, Topology, Multi-host Model
Học được gì:
- TPU types: v4, v5e, v6e, Ironwood (TPU7x) — sự khác biệt cơ bản
- Topology: 3D arrangement của chips, vì sao AxBxC constraints
- Multi-host vs Single-host TPU slices — atomic scaling, ICI interconnect
- Container-to-TPU mapping: "mọi container trong Pod phải consume toàn bộ chips"
- Failure modes: pod preemption requires full topology rebuild, no incremental scaling
Độ dài: ~3800 từ
4. Gang Scheduling & Batch Reservation — ProvisioningRequest, Kueue, Dynamic Workload Scheduler
Học được gì:
- Why gang scheduling matters: correlated failures, resource contention
- ProvisioningRequest API — signal cluster autoscaler "scale atomically for this workload"
- Kueue integration — job queueing, quota management
- Dynamic Workload Scheduler — delay-tolerant workload queuing
- How autoscaler responds: all-or-nothing node provisioning
- Cost implications: waste vs SLO
Độ dài: ~3600 từ
5. GPU Inter-GPU Communication — NCCL Fast Socket, GPUDirect-TCPX/TCPXO, RDMA
Học được gì:
- NCCL Fast Socket: Andromeda integration, bandwidth gains (1.3-2.6x), machine type constraints
- GPUDirect-TCPX (A3 High/Mega): direct GPU-to-NIC bypass
- GPUDirect-TCPXO (A3 Mega): further GPU-to-VM communication reduction
- GPUDirect RDMA (A3 Ultra, A4, B200): true RDMA, best throughput
- Constraints: not stackable (NCCL Fast Socket vs GPUDirect), hardware locked
- Scaling law: network becomes bottleneck at 8-16 GPU, must use GPUDirect tier
Độ dài: ~3900 từ
6. High-Performance Networking — InfiniBand, A3 Clusters, Compact Placement, H4D
Học được gì:
- A3 machine series: H100/H200 GPUs, tight coupling requirements
- InfiniBand-like latency: sub-microsecond p50 latency for collective operations
- Compact placement: locality guarantee for HPC workloads, topolohy-aware scheduling
- H4D (HPC-optimized): 192 cores, up to 1.5TB RAM, designed for tightly-coupled HPC
- Dataplane V2 requirement: why (network acceleration, multi-NIC support)
- Mental model: A3/H4D is "shared supercomputer" not "Kubernetes cluster"
Độ dài: ~3700 từ
7. Data Loading Optimization — Hyperdisk ML, Parallelstore, Volume Populator
Học được gì:
- Data loading is critical path for AI/ML (40-60% of training time in unbounded scenarios)
- Hyperdisk ML: block storage, RWX semantics, concurrent access throughput
- Parallelstore: distributed filesystem, sub-millisecond latency, POSIX semantics, metadata throughput
- GKE Volume Populator: automatic provision + populate from Cloud Storage
- When to use each (latency vs cost vs aggregate throughput)
- Data pipeline patterns: pre-staging, streaming, pipelining with compute
Độ dài: ~3600 từ
8. LLM Serving Patterns — vLLM, TGI, Triton, Optimization Strategies
Học được gì:
- vLLM: PagedAttention, continuous batching, tensor parallelism
- TGI (Text Generation Inference): batching, tensor parallelism, ROPE optimization
- Triton + TensorRT-LLM: kernel fusion, layer optimization, multi-GPU pipelining
- Batch size tuning: latency vs throughput tradeoff
- Autoscaling metrics: queue depth, decode latency (not just CPU/memory)
- When to use which (throughput focus vs latency focus vs cost)
- Model parallelism strategies (TP, PP, DDP combinations)
Độ dài: ~4000 từ
9. Dynamic Resource Allocation (DRA) — Next-Gen GPU Scheduling
Học được gì:
- Device plugins are static (labeled resources), DRA is dynamic (claimed resources)
- DeviceClass: blueprint for hardware categories (high-mem-gpu, low-latency-fpga, etc.)
- ResourceClaim/ResourceClaimTemplate: flexible filtering of available devices
- Scheduler gets global device topology view → better placement decisions
- ResourceSlice: inventorying devices for the scheduler
- DRA + DRANET: extending to network interfaces (multi-NIC scheduling)
- Upgrading from device plugins to DRA (compatibility, migration path)
Độ dài: ~3800 từ
10. Cost Optimization — Spot VMs, Preemption Handling, Billing Models
Học được gì:
- Spot VMs: up to 91% discount, arbitrary preemption window (seconds to hours)
- Spot GPU pricing vs on-demand GPU pricing
- Preemption handling: Pod disruption budgets, graceful shutdown, immediate restart
- Cost modeling: when Spot is worthwhile (fault-tolerance, queueing workloads, etc.)
- Preemption-aware scheduling: avoid setting up workloads that can't survive preemption
- Hybrid strategy: Mix on-demand (gang-scheduled) + Spot (queue-able) workloads
- Actual cost trajectory: batch training (Spot preferred) vs inference (on-demand safe)
Độ dài: ~3500 từ
Navigation
- Mới bắt đầu AI/ML trên GKE? → Bắt đầu với subtopic 1 (GPU Node Pools)
- Đang train large models? → Chú ý subtopic 4-5 (gang scheduling, GPU communication)
- Serving LLMs? → Focus vào subtopic 5 (communication), 8 (LLM patterns)
- HPC workloads (simulations, CFD)? → Subtopic 6 (compact placement)
- Cost-sensitive batch jobs? → Subtopic 4 (gang scheduling) + 10 (Spot VMs)
Key mental models từ chương này
- GPU/TPU ≠ generic resource — chúng có driver stack, topology constraints, scheduling rules riêng
- Communication bandwidth là chìa khóa — scaling GPU từ 1 lên 1000 không phải tuyến tính; network trở thành病症 từ 8 GPU trở lên
- Multiplexing trade-offs — MIG/Time-Slicing giảm cost nhưng tăng latency variance; chọn dựa trên workload pattern
- Topology-aware scheduling — multi-host TPU và HPC clusters phải schedule nguyên trạng, không incremental
- Data loading matters — AI/ML speedup 3-5x từ tối ưu data pipeline (Parallelstore, Hyperdisk ML)
Tài liệu chính thức
- GKE About GPUs
- GKE About TPUs
- GKE GPU Sharing Strategies
- GKE DRA Concepts
- GKE ProvisioningRequest
- Compute Engine GPU Machine Types
Mục tiêu cuối chương: Hiểu được cách design, schedule, optimize GPU/TPU infrastructure trên GKE để maximize utilization, minimize cost, và tránh common pitfalls trong large-scale AI/ML deployments.