Lab: Production Tuning & EPP Optimization

Implicit defaults are for the sandbox. Explicit configuration is for the factory floor.

In the previous lab, you deployed a highly effective distributed inference service using a very short, simple YAML manifest. We relied heavily on the Red Hat OpenShift AI operator to "fill in the blanks"—injecting default health checks, standard networking ports, and default routing algorithms.

While that is perfect for a "Day 1" proof-of-concept, a true enterprise AI Factory leaves nothing to chance. When IT Security, Finance, and Site Reliability Engineering (SRE) review your deployment, they demand strict health checks, custom routing rules, hardware constraints, and metrics pipelines.

In this lab, we will upgrade our LLMInferenceService from a basic deployment to a Production-Grade Manifest.

The Four Pillars of a Production Manifest

Before we apply the new code, let’s break down the four major "upgrades" happening in a production-grade llm-d YAML.

1. Tuning the Brain: The EndpointPickerConfig (EPP)

In our first lab, we turned the Inference Scheduler on and let it use its default logic. In production, you must explicitly program the scheduler’s EndpointPickerConfig algorithm to maximize your GPU ROI.

Notice this block in our upcoming YAML:

schedulingProfiles:
- name: default
  plugins:
  - pluginRef: queue-scorer
    weight: 2
  - pluginRef: kv-cache-utilization-scorer
    weight: 2
  - pluginRef: prefix-cache-scorer
    weight: 3

You are giving the "Traffic Cop" a custom grading rubric. You are explicitly instructing it: "When deciding where to send a prompt, consider the queue length (weight: 2), but prioritize whether the pod already has the context cached in memory (prefix-cache-scorer weight: 3)." Maximizing cache hits prevents the GPU from re-calculating the same math, which drastically lowers your Time-to-First-Token (TTFT).

2. Hardware Profiles and Tolerations

A standard cluster has many types of nodes (CPU, low-end GPUs, high-end GPUs). If your massive model lands on a CPU node, it will fail.

In production, you explicitly wire the deployment into RHOAI’s hardware system using annotations (opendatahub.io/hardware-profile-name: gpu-profile). Furthermore, you define a Kubernetes toleration to ensure the pod is allowed to schedule on a node tainted specifically for NVIDIA GPUs:

tolerations:
  - key: "nvidia.com/gpu"
    operator: "Exists"
    effect: "NoSchedule"

3. Explicit Resiliency: Probes & Timeouts

Large language models take time to load from the vault into GPU memory (VRAM). If you rely on standard Kubernetes health checks, Kubernetes might assume the pod is "dead" because it didn’t respond in 10 seconds, forcing an endless restart loop.

By writing the livenessProbe out explicitly, you align the health checks with the reality of massive models:

livenessProbe:
  httpGet:
    path: /health
    port: 8000
    scheme: HTTPS
  initialDelaySeconds: 120 # Give the massive model 2 full minutes to load into VRAM

4. Unlocking Observability

To prove your GPU ROI to the business, you must expose the metrics. By explicitly defining the --grpc-port, --grpc-health-port, and the --model-server-metrics-scheme, you ensure that Prometheus can scrape the "Golden Signals" (like Cache Hit Rate and GPU Utilization) from the vLLM engines.

Executing the Production Upgrade

Now, we will apply these concepts. We have adapted the production template to point to the secure S3 vault (MinIO) we built in Lab 1.

The Vault vs. Hugging Face

Pulling models directly from the public internet (hf://…​) every time a pod restarts is a massive bottleneck and a security risk. By pointing our production manifest back to our s3:// vault, we ensure rapid, air-gapped recovery if a pod fails.

  1. Review the Production Manifest: Create a file named production-llmd.yaml (or locate it in your cloned rhoai3-llmd-deploy repository) with the following content:

apiVersion: serving.kserve.io/v1alpha1
kind: LLMInferenceService
metadata:
  name: granite-distributed-prod
  namespace: llmd-deploy-lab
  annotations:
    opendatahub.io/hardware-profile-name: gpu-profile
    opendatahub.io/hardware-profile-namespace: redhat-ods-applications
    opendatahub.io/model-type: generative
    openshift.io/display-name: Granite Distributed Prod
spec:
  replicas: 2
  model:
    uri: s3://models/granite3
    name: granite-3
  router:
    scheduler:
      template:
        containers:
          - name: main
            args:
              - '--pool-group'
              - 'inference.networking.x-k8s.io'
              - '--pool-name'
              - '{{ ChildName .ObjectMeta.Name `-inference-pool` }}'
              - '--pool-namespace'
              - '{{ .ObjectMeta.Namespace }}'
              - '--zap-encoder'
              - 'json'
              - '--grpc-port'
              - '9002'
              - '--grpc-health-port'
              - '9003'
              - '--secure-serving'
              - '--model-server-metrics-scheme'
              - 'https'
              - '--config-text'
              - |
                apiVersion: inference.networking.x-k8s.io/v1alpha1
                kind: EndpointPickerConfig
                plugins:
                - type: single-profile-handler
                - type: queue-scorer
                - type: kv-cache-utilization-scorer
                - type: prefix-cache-scorer
                schedulingProfiles:
                - name: default
                  plugins:
                  - pluginRef: queue-scorer
                    weight: 2
                  - pluginRef: kv-cache-utilization-scorer
                    weight: 2
                  - pluginRef: prefix-cache-scorer
                    weight: 3
  template:
    tolerations:
      - key: "nvidia.com/gpu"
        operator: "Exists"
        effect: "NoSchedule"
    containers:
      - name: main
        env:
          - name: VLLM_ADDITIONAL_ARGS
            value: "--disable-uvicorn-access-log --max-model-len=16000 --gpu-memory-utilization=0.95"
        resources:
          limits:
            cpu: '2'
            memory: 12Gi
            nvidia.com/gpu: "1"
          requests:
            cpu: '2'
            memory: 12Gi
            nvidia.com/gpu: "1"
        livenessProbe:
          httpGet:
            path: /health
            port: 8000
            scheme: HTTPS
          initialDelaySeconds: 120
          periodSeconds: 30
          timeoutSeconds: 30
          failureThreshold: 5
  1. Apply the Production Upgrade:

    oc apply -f production-llmd.yaml
  2. Validate the Rollout: Watch the pods as they initialize. Notice that the deployment strictly obeys the 120-second initial delay before marking the pods as ready.

    oc wait --for=condition=Ready llminferenceservice/granite-distributed-prod -n llmd-deploy-lab --timeout=400s

Mission Accomplished

You have successfully transitioned from a "Day 1" proof-of-concept to a hardened, "Day 2" production deployment. Your AI Factory is now actively scoring requests to maximize cache hits, strictly adhering to hardware profiles, and fully instrumented for Prometheus scraping.

This is the standard required for enterprise Models-as-a-Service (MaaS) operations.