Generated banner for Gke AI Troubleshooting Tpu Performance Degradation
Generated logo for Gke AI Troubleshooting Tpu Performance Degradation

Gke AI Troubleshooting Tpu Performance Degradation

GoogleOfficialPublished by Google

  • Skill
  • Review and audit
  • Cloud and DevOps
  • Apache-2.0
  • No issues found

From the author

Diagnose GKE Cloud TPU training throughput drops and step-time regressions (15%+ TPU duty-cycle drop) using ML Diagnostics Workload Monitoring (`gcloud alpha mldiagnostics monitored-events` / `hypercomputecluster.googleapis.com/v1alpha`) and 1-minute Cloud Monitoring system metrics (`kubernetes.io/node/accelerator/*`). Distinguishes hardware and network fabric throttling from workload resource bottlenecks (HBM capacity, host memory, or host CPU saturation). Use when TPU training throughput or duty cycle drops without crashing pods, when `PERFORMANCE_DEGRADATION` monitored events fire, or when triaging slow multi-slice training steps. Don't use for complete multi-slice XLA execution stalls with `HANG_DETECTED` logs (use gke-ai-troubleshooting-tpu-mxla-hang) or pod eviction/interruption restarts (use gke-ai-troubleshooting-jobset-interruption).
— the description by Google

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

This skill provides a structured diagnostic workflow for investigating TPU training throughput drops and step-time regressions on GKE. It leverages ML Diagnostics Workload Monitoring to identify whether performance issues stem from workload-specific resource bottlenecks (such as HBM, host memory, or CPU) or infrastructure-level throttling (such as network fabric or thermal issues). The process involves correlating monitored events with 1-minute Cloud Monitoring metrics and mapping culprit instances to GKE node topology to guide appropriate remediation.

What it does

  • Lists and describes ML Diagnostics monitored events for performance degradation.
  • Correlates performance drops with 1-minute system metrics using PromQL queries.
  • Maps infrastructure-level culprit instance IDs to specific GKE nodes and topology blocks.
  • Routes users to specific remediation paths based on the detected bottleneck category.
  • Provides guardrails to prevent unnecessary node operations for workload-related issues.

When to use it

  • When TPU training throughput or duty cycle drops by 15% or more without pod crashes.
  • When a PERFORMANCE_DEGRADATION monitored event is triggered.
  • When triaging slow multi-slice training steps.
  • To distinguish between workload resource bottlenecks and infrastructure throttling.

Advantages

  • Reduces mean time to resolution by automating the correlation of diagnostic data.
  • Prevents disruptive node operations by correctly identifying workload-side bottlenecks.
  • Provides clear, actionable paths for both infrastructure and application-level issues.
  • Ensures consistent diagnostic practices through standardized CLI and monitoring queries.

Usage examples

“My TPU training job is running slowly. How can I check if there is a performance degradation event?”
The agent will guide you through listing ML runs and checking for PERFORMANCE_DEGRADATION events using the gcloud alpha mldiagnostics CLI.
“I see a performance degradation event. How do I know if it is a hardware issue or my code?”
The agent will help you inspect the analyzer reports and run PromQL queries to determine if the bottleneck is in HBM/CPU or infrastructure-related.

Install

  1. Download the skill as a ZIP:

    https://autogineer.com/agent-skills/google/gke-ai-troubleshooting-tpu-performance-degradation/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip gke-ai-troubleshooting-tpu-performance-degradation.zip -d .agents/skills

Documentation by Google

Troubleshoot GKE TPU performance degradation with ML Diagnostics Workload Monitoring

Diagnose and mitigate Cloud TPU training throughput drops and step-time regressions (15%+ drop in TPU duty cycle) on Google Kubernetes Engine (GKE) by correlating ML Diagnostics Workload Monitoring MonitoredEvent analyzer reports with 1-minute Cloud Monitoring system metrics and GKE node topology labels.


Attribution

MUST READ: Before executing any gcloud, REST API, or MCP command, you MUST read Usage Attribution. For commands executed directly in the terminal (never in generated scripts, Terraform, or user code), prefix gcloud with CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:gke-ai-troubleshooting-tpu-performance-degradation)" and append agent-skills/1.0 (skill:gke-ai-troubleshooting-tpu-performance-degradation) to User-Agent headers.

Prerequisites

  • Tools: Install the Google Cloud SDK (gcloud with alpha component for gcloud alpha mldiagnostics) and kubectl.

  • Cloud Billing & Project Configuration: Verify an active billing account is linked (gcloud billing projects describe {project_id}), authenticate (gcloud auth login), set the target project (gcloud config set project {project_id}), and ensure container.googleapis.com, monitoring.googleapis.com, and hypercomputecluster.googleapis.com are enabled.

  • Supported workloads and GKE versions: Google Cloud ML Diagnostics only supports JAX on TPUs (see ML Diagnostics platform). Workload Monitoring is enabled by default, supports the jobset and job GKE job types, and is compatible with GKE versions 1.36.0-gke.4681000 and later, as stated in Configure GKE for ML Diagnostics. If a workload uses another framework (such as PyTorch) or another custom resource type, gcloud alpha mldiagnostics won't list ML runs or monitored events for it. On-demand profiling (Step 4 Path A) additionally requires the cluster setup described in that document.

  • Required IAM Roles:

    • Cluster Director Editor (roles/hypercomputecluster.editor), the role listed in the "IAM permissions" section of ML Diagnostics platform, for the ML Diagnostics CLI and API calls in this skill (ML runs, monitored events, and on-demand profiler sessions)

    • Monitoring Viewer (roles/monitoring.viewer) for the PromQL queries in Step 2

    • Kubernetes Engine Viewer (roles/container.viewer) for the kubectl get nodes query in Step 3

    • For remediation ([High Risk] steps): Kubernetes Engine Cluster Admin (roles/container.clusterAdmin)

  • Reference Documentation:

Read-only rule: Run read-only diagnostic commands only. Never drain, delete, or re-create nodes, or run any other command that changes the cluster. Give the user any fix to apply themselves.

When you recommend a fix, link the doc section that describes it.


Analyzer routing overview

By default, Workload Monitoring treats a 15% drop in TPU duty cycle as a performance degradation, raises a MonitoredEvent (type: PERFORMANCE_DEGRADATION), and runs its analyzers. Consult the Workload Monitoring and analyzers section in the official Cloud TPU documentation for the complete analyzer definitions, detection criteria, and subsections, and route remediation by category:

  • Category A: workload resource bottlenecks (never cordon or replace nodes):

  • Category B: infrastructure and network fabric throttling (culprit nodes):

  • Category C: PERFORMANCE_DEGRADATION event fired, but no analyzer reports detectionState: "DETECTED":


Diagnostic workflow

Step 0: Collect context and set the investigation window [Low Risk]

Collect the target parameters. By default, query a 60-minute window `[T - 30m, T

  • 30m]around{issue_time}`:

  • {project_id}: Google Cloud project ID

  • {location}: Google Cloud region where the ML run and GKE cluster reside (for example, us-central1)

  • {cluster_name}: GKE cluster name

  • {workload_name} / {ml_run_id}: JobSet / workload name or ML Diagnostics run ID

  • {issue_time}: Timestamp when throughput degradation was observed (T, ISO-8601 UTC)

  • {start_time}: T - 30m

  • {end_time}: T + 30m


Step 1: Query ML runs and monitoredEvents [Low Risk]
  1. List active or recent ML runs: Give the user gcloud alpha mldiagnostics machine-learning-run list with a link to List machine learning runs in the ML Diagnostics CLI reference, and locate {ml_run_id} matching {workload_name}.

  2. List performance degradation events: Give the user gcloud alpha mldiagnostics monitored-events list with a link to Monitored-events commands, or the hypercomputecluster.googleapis.com/v1alpha API with a link to Access Workload Monitoring information through the API, to check for PERFORMANCE_DEGRADATION events during [{start_time}, {end_time}].

  3. Describe the MonitoredEvent: Give the user gcloud alpha mldiagnostics monitored-events describe with a link to the same Monitored-events commands section, and inspect the analyzerReports array (analyzer, detectionState, details, and recommendedActions).

    • If a PERFORMANCE_DEGRADATION event fired, run Step 2 to corroborate with the 1-minute system metrics; if none of its analyzerReports entries has detectionState: "DETECTED", follow Path C: Event fired with no DETECTED analyzer.

    • If no PERFORMANCE_DEGRADATION event exists and duty cycle is steady in Step 2, rule out TPU performance degradation by following Path D: Healthy telemetry.


Step 2: Correlate with 1-minute Cloud Monitoring system metrics [Low Risk]

Consult the System Metrics section in the Workload Monitoring documentation for the 1-minute Cloud Monitoring metrics exported for TPU and host devices, and run read-only PromQL queries over [{start_time}, {end_time}] to corroborate the analyzer report:

# 1. Node TPU duty cycle (look for the drop on the affected nodes)
kubernetes_io:node_accelerator_duty_cycle{
  monitored_resource="k8s_node",
  project_id="{project_id}",
  cluster_name="{cluster_name}"
}

# 2. HBM utilization ratio by node (around 0.90 is approaching the limit)
sum by (node_name) (
  kubernetes_io:node_accelerator_memory_used{
    monitored_resource="k8s_node",
    project_id="{project_id}",
    cluster_name="{cluster_name}"
  }
)
/
sum by (node_name) (
  kubernetes_io:node_accelerator_memory_total{
    monitored_resource="k8s_node",
    project_id="{project_id}",
    cluster_name="{cluster_name}"
  }
)

# 3. Host memory and CPU allocatable utilization
kubernetes_io:node_memory_allocatable_utilization{
  monitored_resource="k8s_node",
  project_id="{project_id}",
  cluster_name="{cluster_name}"
}

kubernetes_io:node_cpu_allocatable_utilization{
  monitored_resource="k8s_node",
  project_id="{project_id}",
  cluster_name="{cluster_name}"
}

Step 3: Map culprit instance IDs to GKE nodes and topology [Low Risk]

When an infrastructure analyzer reports culprit numeric Compute Engine instance IDs in details or recommendedActions, map those numeric instance IDs to GKE Node names and physical topology blocks using this read-only kubectl query inspecting container.googleapis.com/instance_id:

kubectl get nodes -l cloud.google.com/gke-tpu-accelerator \
  -o jsonpath='{range .items[*]}{.metadata.name}{"\tinstance_id="}{.metadata.annotations.container\.googleapis\.com/instance_id}{"\tblock="}{.metadata.labels.cloud\.google\.com/gce-topology-block}{"\tsubblock="}{.metadata.labels.cloud\.google\.com/gce-topology-subblock}{"\thost="}{.metadata.labels.cloud\.google\.com/gce-topology-host}{"\n"}{end}'

Step 4: Remediation by analyzer category

Load and follow only the reference file that matches the analyzer category from Step 1:


Guardrails

  1. Never change GKE-managed instance groups or VMs through Compute Engine: Don't run gcloud compute instance-groups managed commands, such as delete, on a node pool's managed instance group. Handle nodes through GKE, as described in Path B: Infrastructure or network fabric throttling.

  2. Never cordon nodes for workload resource saturation: If only the HBM capacity, host memory, or host CPU utilization analyzers detected an issue, don't cordon or replace nodes.

Files

references/attribution.md

Usage Attribution

MUST READ: Before executing any gcloud, REST API, or MCP command with this skill, follow these usage attribution instructions. Tag every command you execute directly in the terminal so usage can be attributed. The tag identifies only the skill and its version; it carries no user data.

  • gcloud CLI Commands: Prefix every gcloud invocation, whatever the subcommand, with the metrics environment variable. Set it inline on each command because shell state may not persist between commands:

    CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:gke-ai-troubleshooting-tpu-performance-degradation)" \
    gcloud <command> [flags]

    Do not use gcloud config set for this: it would persist beyond the current task and mislabel unrelated usage.

  • Direct HTTP, REST, and MCP Requests: On direct HTTP calls to Google Cloud APIs (for example with curl) or HTTP requests to a remote MCP server, include agent-skills/1.0 (skill:gke-ai-troubleshooting-tpu-performance-degradation) in the User-Agent header. If a User-Agent header is already specified, append this string to the end of it rather than overwriting existing User-Agent data — the collection pipeline parses the agent-skills/<version> and skill:<name> tokens, so any rewording breaks attribution:

    User-Agent: <existing_user_agent> agent-skills/1.0 (skill:gke-ai-troubleshooting-tpu-performance-degradation)
  • Constraint for Generated Code: The tracking prefix is strictly for commands you execute directly in the terminal. Do NOT include this tracking prefix in generated scripts, Terraform templates, or code provided to the user for their own repositories.

  • User Opt-Out: If the user asks to disable or remove tracking or attribution tags, omit the CLOUDSDK_METRICS_REQUEST_ATTRIBUTION variable and custom User-Agent suffix from all commands.

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Needs: Needs a command-line tool, Needs Node.js

Security

No issues found by our static scan· No issues found

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Published by
Google
Publisher
Google (Official)
Source
google/skills · skills/cloud/gke-ai-troubleshooting-tpu-performance-degradation · commit 2194d3b
Licence
Apache License 2.0 (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by Google or Google.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download gke-ai-troubleshooting-tpu-performance-degradation.zip