GKE TPU Performance Degradation Troubleshooting

GKE TPU Performance Degradation Troubleshooting

Diagnoses drops in GKE Cloud TPU training throughput by correlating monitoring events with system metrics, separating hardware throttling from workload bottlenecks.

Skill files6 files

references/

SKILL.md287 lines
1
---
2
name: gke-ai-troubleshooting-tpu-performance-degradation
3
description: >-
4
Diagnose GKE Cloud TPU training throughput drops and step-time regressions
5
(15%+ TPU duty-cycle drop) using ML Diagnostics Workload Monitoring (`gcloud
6
alpha mldiagnostics monitored-events` /
7
`hypercomputecluster.googleapis.com/v1alpha`) and 1-minute Cloud Monitoring
8
system metrics (`kubernetes.io/node/accelerator/*`). Distinguishes hardware
9
and network fabric throttling from workload resource bottlenecks (HBM
10
capacity, host memory, or host CPU saturation). Use when TPU training
11
throughput or duty cycle drops without crashing pods, when
12
`PERFORMANCE_DEGRADATION` monitored events fire, or when triaging slow
13
multi-slice training steps. Don't use for complete multi-slice XLA execution
14
stalls with `HANG_DETECTED` logs (use gke-ai-troubleshooting-tpu-mxla-hang) or
15
pod eviction/interruption restarts (use
16
gke-ai-troubleshooting-jobset-interruption).
17
metadata:
18
version: "1.0.1"
19
category: AiAndMachineLearning
20
---
21
22
# Troubleshoot GKE TPU performance degradation with ML Diagnostics Workload Monitoring
23
24
Diagnose and mitigate Cloud TPU training throughput drops and step-time
25
regressions (`15%+` drop in TPU duty cycle) on Google Kubernetes Engine (GKE) by
26
correlating **ML Diagnostics Workload Monitoring** `MonitoredEvent` analyzer
27
reports with **1-minute Cloud Monitoring system metrics** and GKE node topology
28
labels.
29
30
---
31
32
## Attribution
33
34
**MUST READ**: Before executing any `gcloud`, REST API, or MCP command, you
35
MUST read [Usage Attribution](references/attribution.md). For commands executed
36
directly in the terminal (never in generated scripts, Terraform, or user code),
37
prefix `gcloud` with
38
`CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:gke-ai-troubleshooting-tpu-performance-degradation)"`
39
and append `agent-skills/1.0 (skill:gke-ai-troubleshooting-tpu-performance-degradation)` to `User-Agent` headers.
40
41
## Prerequisites
42
43
- **Tools**: Install the
44
[Google Cloud SDK](https://cloud.google.com/sdk/docs/install) (`gcloud` with
45
`alpha` component for `gcloud alpha mldiagnostics`) and `kubectl`.
46
- **Cloud Billing & Project Configuration**: Verify an active billing account is
47
linked (`gcloud billing projects describe {project_id}`), authenticate
48
(`gcloud auth login`), set the target project (`gcloud config set project
49
{project_id}`), and ensure `container.googleapis.com`,
50
`monitoring.googleapis.com`, and `hypercomputecluster.googleapis.com` are
51
enabled.
52
- **Supported workloads and GKE versions**: Google Cloud ML Diagnostics only
53
supports JAX on TPUs (see
54
[ML Diagnostics platform](https://docs.cloud.google.com/tpu/docs/ml-diagnostics/overview.md.txt)).
55
Workload Monitoring is enabled by default, supports the `jobset` and `job` GKE
56
job types, and is compatible with GKE versions `1.36.0-gke.4681000` and later,
57
as stated in
58
[Configure GKE for ML Diagnostics](https://docs.cloud.google.com/tpu/docs/ml-diagnostics/gke.md.txt).
59
If a workload uses another framework (such as PyTorch) or another custom
60
resource type, `gcloud alpha mldiagnostics` won't list ML runs or monitored
61
events for it. On-demand profiling (Step 4 Path A) additionally requires the
62
cluster setup described in that document.
63
- **Required IAM Roles**:
64
- Cluster Director Editor (`roles/hypercomputecluster.editor`), the role
65
listed in the "IAM permissions" section of
66
[ML Diagnostics platform](https://docs.cloud.google.com/tpu/docs/ml-diagnostics/overview.md.txt),
67
for the ML Diagnostics CLI and API calls in this skill (ML runs, monitored
68
events, and on-demand profiler sessions)
69
- Monitoring Viewer (`roles/monitoring.viewer`) for the PromQL queries in Step
70
2
71
- Kubernetes Engine Viewer (`roles/container.viewer`) for the `kubectl get
72
nodes` query in Step 3
73
- For remediation (`[High Risk]` steps): Kubernetes Engine Cluster Admin
74
(`roles/container.clusterAdmin`)
75
- **Reference Documentation**:
76
- [ML Diagnostics platform](https://docs.cloud.google.com/tpu/docs/ml-diagnostics/overview.md.txt)
77
(Sections: "IAM permissions")
78
- [Configure GKE for ML Diagnostics](https://docs.cloud.google.com/tpu/docs/ml-diagnostics/gke.md.txt)
79
(Sections: "Set up with gcloud CLI, Google Cloud console, or Terraform",
80
"Manual installation", "Connection-operator")
81
- [Workload monitoring with ML Diagnostics](https://docs.cloud.google.com/tpu/docs/ml-diagnostics/workload-monitoring.md.txt)
82
(Sections: "Workload Monitoring and analyzers", "HBM Capacity Analyzer",
83
"Host Memory Utilization Analyzer", "CPU Utilization Analyzer", "Access
84
Workload Monitoring information through the API", "List all monitored
85
events", "System Metrics")
86
- [Get started with the ML Diagnostics CLI](https://docs.cloud.google.com/tpu/docs/ml-diagnostics/cli.md.txt)
87
(Sections: "List machine learning runs", "Monitored-events commands", "List
88
profiler targets", "Capture on-demand profiler sessions")
89
- [Scale container resource requests and limits](https://docs.cloud.google.com/kubernetes-engine/docs/how-to/vertical-pod-autoscaling.md.txt)
90
(Sections: "Identify workloads without resource requests or limits")
91
- [Auto-repair nodes](https://docs.cloud.google.com/kubernetes-engine/docs/how-to/node-auto-repair.md.txt)
92
(Sections: "Repair criteria", "Verify node auto-repair is enabled for a
93
Standard node pool", "Enable auto-repair for an existing Standard node
94
pool", "Node auto repair in TPU slice nodes")
95
- [Deploy TPU workloads in GKE Standard](https://docs.cloud.google.com/kubernetes-engine/docs/how-to/tpus.md.txt)
96
(Sections: "Configure auto repair for TPU slice nodes")
97
- [Get support](https://docs.cloud.google.com/kubernetes-engine/docs/getting-support.md.txt)
98
(Sections: "Before you contact support")
99
100
> **Read-only rule**: Run read-only diagnostic commands only. Never drain,
101
> delete, or re-create nodes, or run any other command that changes the cluster.
102
> Give the user any fix to apply themselves.
103
104
When you recommend a fix, link the doc section that describes it.
105
106
---
107
108
## Analyzer routing overview
109
110
By default, Workload Monitoring treats a 15% drop in TPU duty cycle as a
111
performance degradation, raises a `MonitoredEvent` (`type:
112
PERFORMANCE_DEGRADATION`), and runs its analyzers. Consult the
113
[Workload Monitoring and analyzers](https://docs.cloud.google.com/tpu/docs/ml-diagnostics/workload-monitoring.md.txt)
114
section in the official Cloud TPU documentation for the complete analyzer
115
definitions, detection criteria, and subsections, and route remediation by
116
category:
117
118
- **Category A: workload resource bottlenecks (never cordon or replace nodes)**:
119
- When the firing analyzer (`detectionState: "DETECTED"`) indicates a workload
120
memory or host CPU capacity bottleneck (see the "HBM Capacity Analyzer",
121
"Host Memory Utilization Analyzer", and "CPU Utilization Analyzer" sections
122
of
123
[Workload monitoring with ML Diagnostics](https://docs.cloud.google.com/tpu/docs/ml-diagnostics/workload-monitoring.md.txt)),
124
route to
125
[Path A: Workload resource bottlenecks](references/path-a-workload-bottlenecks.md)
126
(workload optimization and profiling).
127
- **Category B: infrastructure and network fabric throttling (culprit nodes)**:
128
- When the firing analyzer (`detectionState: "DETECTED"`) indicates an
129
interconnect, thermal/power throttling, memory bandwidth, or Top-of-Rack
130
(ToR) network fault on specific instances (see
131
[Workload Monitoring and analyzers](https://docs.cloud.google.com/tpu/docs/ml-diagnostics/workload-monitoring.md.txt)),
132
route to
133
[Path B: Infrastructure or network fabric throttling](references/path-b-infrastructure-throttling.md)
134
(map the culprit Compute Engine instance IDs to GKE nodes, handle node
135
repair through GKE, and escalate to Google Cloud Support).
136
- **Category C: `PERFORMANCE_DEGRADATION` event fired, but no analyzer reports
137
`detectionState: "DETECTED"`**:
138
- When a `PERFORMANCE_DEGRADATION` event exists (as in the sample output in
139
[List all monitored events](https://docs.cloud.google.com/tpu/docs/ml-diagnostics/workload-monitoring.md.txt),
140
where `analyzerReports` entries have `detectionState: "NOT_DETECTED"`),
141
route to
142
[Path C: Event fired with no DETECTED analyzer](references/path-c-no-detected-analyzer.md).
143
144
---
145
146
## Diagnostic workflow
147
148
### Step 0: Collect context and set the investigation window `[Low Risk]`
149
150
Collect the target parameters. By default, query a 60-minute window `[T - 30m, T
151
+ 30m]` around `{issue_time}`:
152
153
- `{project_id}`: Google Cloud project ID
154
- `{location}`: Google Cloud region where the ML run and GKE cluster reside (for
155
example, `us-central1`)
156
- `{cluster_name}`: GKE cluster name
157
- `{workload_name}` / `{ml_run_id}`: JobSet / workload name or ML Diagnostics
158
run ID
159
- `{issue_time}`: Timestamp when throughput degradation was observed (`T`,
160
ISO-8601 UTC)
161
- `{start_time}`: `T - 30m`
162
- `{end_time}`: `T + 30m`
163
164
---
165
166
### Step 1: Query ML runs and `monitoredEvents` `[Low Risk]`
167
168
1. **List active or recent ML runs**: Give the user `gcloud alpha mldiagnostics
169
machine-learning-run list` with a link to
170
[List machine learning runs](https://docs.cloud.google.com/tpu/docs/ml-diagnostics/cli.md.txt)
171
in the ML Diagnostics CLI reference, and locate `{ml_run_id}` matching
172
`{workload_name}`.
173
2. **List performance degradation events**: Give the user `gcloud alpha
174
mldiagnostics monitored-events list` with a link to
175
[Monitored-events commands](https://docs.cloud.google.com/tpu/docs/ml-diagnostics/cli.md.txt),
176
or the `hypercomputecluster.googleapis.com/v1alpha` API with a link to
177
[Access Workload Monitoring information through the API](https://docs.cloud.google.com/tpu/docs/ml-diagnostics/workload-monitoring.md.txt),
178
to check for `PERFORMANCE_DEGRADATION` events during `[{start_time},
179
{end_time}]`.
180
3. **Describe the `MonitoredEvent`**: Give the user `gcloud alpha mldiagnostics
181
monitored-events describe` with a link to the same
182
[Monitored-events commands](https://docs.cloud.google.com/tpu/docs/ml-diagnostics/cli.md.txt)
183
section, and inspect the `analyzerReports` array (`analyzer`,
184
`detectionState`, `details`, and `recommendedActions`).
185
- If a `PERFORMANCE_DEGRADATION` event fired, run Step 2 to corroborate with
186
the 1-minute system metrics; if none of its `analyzerReports` entries has
187
`detectionState: "DETECTED"`, follow
188
[Path C: Event fired with no DETECTED analyzer](references/path-c-no-detected-analyzer.md).
189
- If no `PERFORMANCE_DEGRADATION` event exists and duty cycle is steady in
190
Step 2, **rule out** TPU performance degradation by following
191
[Path D: Healthy telemetry](references/path-d-healthy-telemetry.md).
192
193
---
194
195
### Step 2: Correlate with 1-minute Cloud Monitoring system metrics `[Low Risk]`
196
197
Consult the
198
[System Metrics](https://docs.cloud.google.com/tpu/docs/ml-diagnostics/workload-monitoring.md.txt)
199
section in the Workload Monitoring documentation for the 1-minute Cloud
200
Monitoring metrics exported for TPU and host devices, and run read-only PromQL
201
queries over `[{start_time}, {end_time}]` to corroborate the analyzer report:
202
203
```promql
204
# 1. Node TPU duty cycle (look for the drop on the affected nodes)
205
kubernetes_io:node_accelerator_duty_cycle{
206
monitored_resource="k8s_node",
207
project_id="{project_id}",
208
cluster_name="{cluster_name}"
209
}
210
211
# 2. HBM utilization ratio by node (around 0.90 is approaching the limit)
212
sum by (node_name) (
213
kubernetes_io:node_accelerator_memory_used{
214
monitored_resource="k8s_node",
215
project_id="{project_id}",
216
cluster_name="{cluster_name}"
217
}
218
)
219
/
220
sum by (node_name) (
221
kubernetes_io:node_accelerator_memory_total{
222
monitored_resource="k8s_node",
223
project_id="{project_id}",
224
cluster_name="{cluster_name}"
225
}
226
)
227
228
# 3. Host memory and CPU allocatable utilization
229
kubernetes_io:node_memory_allocatable_utilization{
230
monitored_resource="k8s_node",
231
project_id="{project_id}",
232
cluster_name="{cluster_name}"
233
}
234
235
kubernetes_io:node_cpu_allocatable_utilization{
236
monitored_resource="k8s_node",
237
project_id="{project_id}",
238
cluster_name="{cluster_name}"
239
}
240
```
241
242
---
243
244
### Step 3: Map culprit instance IDs to GKE nodes and topology `[Low Risk]`
245
246
When an infrastructure analyzer reports culprit numeric Compute Engine instance
247
IDs in `details` or `recommendedActions`, map those numeric instance IDs to GKE
248
`Node` names and physical topology blocks using this read-only `kubectl` query
249
inspecting `container.googleapis.com/instance_id`:
250
251
```bash
252
kubectl get nodes -l cloud.google.com/gke-tpu-accelerator \
253
-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}'
254
```
255
256
---
257
258
### Step 4: Remediation by analyzer category
259
260
Load and follow only the reference file that matches the analyzer category from
261
Step 1:
262
263
- **Path A (workload resource bottlenecks — HBM, host memory, or host CPU
264
utilization)**: Read
265
[Path A: Workload resource bottlenecks](references/path-a-workload-bottlenecks.md).
266
- **Path B (infrastructure, thermal, ICI, memory bandwidth, or network fabric
267
throttling)**: Read
268
[Path B: Infrastructure or network fabric throttling](references/path-b-infrastructure-throttling.md).
269
- **Path C (`PERFORMANCE_DEGRADATION` event fired with all analyzers
270
`NOT_DETECTED`)**: Read
271
[Path C: Event fired with no DETECTED analyzer](references/path-c-no-detected-analyzer.md).
272
- **Path D (no `PERFORMANCE_DEGRADATION` events and steady telemetry)**: Read
273
[Path D: Healthy telemetry](references/path-d-healthy-telemetry.md).
274
275
---
276
277
## Guardrails
278
279
1. **Never change GKE-managed instance groups or VMs through Compute Engine**:
280
Don't run `gcloud compute instance-groups managed` commands, such as
281
`delete`, on a node pool's managed instance group. Handle nodes through GKE,
282
as described in
283
[Path B: Infrastructure or network fabric throttling](references/path-b-infrastructure-throttling.md).
284
2. **Never cordon nodes for workload resource saturation**: If only the HBM
285
capacity, host memory, or host CPU utilization analyzers detected an issue,
286
don't cordon or replace nodes.
287

© Google LLC · Apache 2.0 · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 14,621 prompts

More by @OpenSourceBuffGuy

See all
Sea turtle carrying floating film studio island prompt image

Sea turtle carrying floating film studio island

Draws a giant sea turtle carrying a floating island film studio through a starry sky, where fairies polish rough film strips into golden film.

image-prompt, nano-banana, 3d-render, cartoon, fantasy-world, creatures, animals, whimsical, dreamy, cinematic, dramatic-lighting, vibrant-colors, bokeh, miniature, widescreen, night-scene, illustration, concept-art, surreal, storytelling, clay-3d

Desert buggy escapes drones past industrial outpost prompt image

Desert buggy escapes drones past industrial outpost

Builds a 15-second desert chase video where a racer in an armored buggy escapes drones past an industrial outpost, using five reference images with set jobs.

video-prompt, hailuo, action, multi-shot, timed-beats, camera-movement, reference-image, character-consistency, negative-prompt, cinematic, sci-fi, cars, landscape, aerial-view, tracking-shot, photorealistic, sound-effects, structured-output, long-form, widescreen

1 view
Cozy Pixel Art Farm Island Village prompt image

Cozy Pixel Art Farm Island Village

Draws a cozy 16-bit pixel-art farming village across six small islands joined by bridges, with exact counts for buildings, animals and crops.

image-prompt, gpt-image, pixel-art, isometric, game-assets, concept-art, maps, worldbuilding, cozy, vibrant-colors, ocean, landscape, wide-shot, widescreen, game-development, video-games, structured-output, whimsical, summer, high-angle, aerial-view, animals, negative-prompt, cityscape

1 view

Reviews

Loading reviews…

Discussion

Loading comments…