starrocks/starrocks-debug-skills/cpu-saturation

Claude Code and agent skill by starrocks/starrocks-debug-skills

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Use as the first stop when a BE or FE host shows high CPU (elevated load average or top near 100%). Attributes CPU to the right workload — query pipeline, import flush/compression, compaction threads, background tasks, FE GC, or non-StarRocks processes — then hands off to the appropriate deep-dive skill (query/import/compaction/node). Does not resolve root causes directly; acts as a triage and attribution layer.

Install

npx vskill@latest install starrocks/starrocks-debug-skills/cpu-saturation

SKILL.md

CPU Saturation Triage

Investigation guide for BE or machine CPU saturation. This skill focuses on attribution: which process, which module, and which workload is consuming CPU. After attribution, follow the referenced deep-dive skill for root-cause analysis.


Metric Taxonomy — Read This First

Before using the decision tree, establish what the CPU is doing and which process owns it.

OS-level CPU indicators
MetricMeaning
us (user) in topUser-space CPU — StarRocks computation, compression
sy (system) in topKernel CPU — system calls, IO, interrupts; high sy with us suggests thread overhead
wa (iowait) in topCPU waiting for disk IO — not CPU saturation, disk bottleneck
st (steal) in topCPU stolen by hypervisor (VM environments only) — noisy neighbor
Load averageRunning + runnable threads; >vCPU count indicates oversubscription

How to retrieve:

bash
# Snapshot CPU breakdown
top -b -n 1 | head -5
# Output: %Cpu(s): 85.2 us, 8.3 sy, 0.0 ni, 3.1 id, 2.1 wa, 0.0 hi, 1.3 si, 0.0 st
# Per-process CPU (10-second sample)
pidstat -u 2 5
# Load average vs CPU count
uptime
# Load average: 64.2, 58.1, 52.3 → compare to: nproc (e.g., 32 CPUs → overloaded)
nproc
BE-level CPU classification metrics (v3.4+)
MetricMeaning
starrocks_be_cpu_task_queryCPU time consumed by query pipeline threads
starrocks_be_cpu_task_loadCPU time consumed by import/flush threads
starrocks_be_cpu_task_compactionCPU time consumed by compaction threads
starrocks_be_cpu_task_cloneCPU time consumed by tablet clone (rebalance)

How to retrieve:

bash
# Pull all BE CPU task metrics
curl -s "http://<be_host>:<be_http_port>/metrics" | grep "starrocks_be_cpu"
# Loop across all BEs to find the hotspot node
for be in <be1> <be2> <be3>; do
echo "=== $be ==="
curl -s "http://$be:8040/metrics" | grep "starrocks_be_cpu_task"
done
FE-level CPU indicators
Metric / ObservableMeaning
java process CPU in topFE planning storm or GC pressure
GC CPU ratio from fe.gc.logHigh GC CPU (>30% of elapsed) indicates heap pressure
jstack — many RUNNABLE threads in optimizer codeQuery planning CPU storm

How to retrieve:

bash
# FE Java process CPU
top -b -n 1 | grep java
# Per-thread breakdown for FE JVM
top -Hp $(pgrep -f 'StarRocksFE\|fe.pid') | head -20
# Convert thread ID (decimal) to hex → cross-reference with jstack
# FE thread dump
jstack $(cat fe/bin/fe.pid) > /tmp/fe_jstack.log
grep -c "RUNNABLE" /tmp/fe_jstack.log
# High RUNNABLE count relative to vCPUs → planning storm or GC
# GC pressure
grep "GC" fe/log/fe.gc.log | tail -20
Function-level CPU attribution
Hot function prefixLikely module
starrocks::pipeline::Query pipeline executor
starrocks::vectorized::Vectorized evaluation (scan / aggregate / join)
starrocks::MemTable::Import memtable flush
starrocks::Compaction::Compaction
starrocks::SegmentWriter::Import segment write
starrocks::lake::Shared-data operations
snappy:: / lz4:: / zstd::Compression (flush or compaction)
tcmalloc:: / mallocMemory allocator contention
starrocks::SchemaChangeSchema change task
starrocks::cloneTablet clone (rebalance)

How to retrieve:

bash
# Live hot functions (needs root or perf permission)
perf top -p $(pidof starrocks_be) -d 5
# Format: [overhead%] [symbol_name] [DSO]
# Focus on the top 5 functions; the prefix identifies the module
# Quick thread snapshot without perf
pstack $(pidof starrocks_be) > /tmp/be_pstack_$(date +%s).log
grep -oE "starrocks::[A-Za-z:]+" /tmp/be_pstack_$(date +%s).log | sort | uniq -c | sort -rn | head -20

Key rules for interpretation:

  1. High wa (iowait) is NOT CPU saturation — it means CPU is idle waiting for disk. Diagnose with iostat -x 1, then follow compaction/SKILL.md or import/SKILL.md.
  2. starrocks_be_cpu_task_* metrics are available only in v3.4+. On older versions, use perf top or pidstat for function-level attribution.
  3. If ALL metrics degrade simultaneously (query + import + compaction), suspect a non-StarRocks process or hypervisor steal (st > 0) rather than a StarRocks-internal cause.
  4. BE CPU metrics are per-BE — always identify the hotspot node first before applying cluster-wide changes.
  5. FE GC CPU exceeding 30% of elapsed wall time is a separate problem from BE CPU saturation and requires heap/GC tuning, not thread reduction.

CPU Saturation Signal Reference

Observation combinationMost likely root causeFirst checkpoint
us high; query latency up; import and compaction normalQuery-caused (Section 3a)SHOW PROC '/current_queries'; perf top shows vectorized::
us high; import latency up; perf top shows MemTable:: / snappy::Import compression CPU (Section 3b)starrocks_be_cpu_task_load metric
us high; compaction score dropping; query slow; perf top shows Compaction::Compaction over-provisioned (Section 3c)starrocks_be_cpu_task_compaction; reduce threads
ALL metrics degrade simultaneously; st > 0 in VM or non-StarRocks process in topNon-StarRocks process or hypervisor steal (Section 5)ps aux --sort=-%cpu; top %st
java process CPU high; FE queries stuck in PlanningFE planning storm or GC (Section 4)jstack + top -Hp; fe.gc.log
wa (iowait) high; us normalIO bottleneck, not CPUiostat -x 1; see compaction/SKILL.md
sy high; many threads in top -HpThread scheduling overheadReduce pipeline_dop or compaction thread count
starrocks_be_cpu_task_clone elevatedTablet rebalance consuming CPUSHOW PROC '/cluster_balance'; throttle clone

Triage Decision Tree

CPU saturation observed (load average high or top shows 100% on a node)
│
├─ Step 1: Which process owns the CPU?
│ → see Section 1
│
├─ Process = starrocks_be
│ └─ Step 2: Which BE module?
│ → see Section 2
│ ├─ Queries → Section 3a + query/SKILL.md
│ ├─ Import → Section 3b + import/SKILL.md
│ ├─ Compaction → Section 3c + compaction/SKILL.md
│ └─ Background task / unknown → Section 3d
│
├─ Process = java (FE)
│ → FE Full GC or planning storm → Section 4 + node/SKILL.md
│
└─ Process = non-StarRocks (backup agent, kernel, etc.)
→ Section 5: OS-level attribution

1. Which Process Owns the CPU?

bash
# Snapshot: top CPU consumers by process
top -b -n 1 | head -20
# More detail: per-thread breakdown for a single process
top -Hp $(pidof starrocks_be) | head -30
# Or use pidstat for sustained view
pidstat -u 2 10
ObservationNext Step
starrocks_be is top consumerSection 2
java (FE) is top consumerSection 4
Other process (mysqld, rsync, python...)Section 5
kworker / ksoftirqd / kernel threadsNetwork interrupt or disk IRQ — check sar -I ALL, iostat
CPU wa (iowait) is high, not usIO bottleneck, not CPU — see compaction/SKILL.md or import/SKILL.md

2. Which BE Module?

Step 2a: Quick workload inventory
sql
-- Any active long-running queries?
SHOW PROC '/current_queries';
-- Look for QueryTime > 30s or MemUsageBytes > 1GB
-- Any active imports?
SELECT LABEL, STATE, PROGRESS, TYPE, LOAD_START_TIME
FROM information_schema.loads
WHERE STATE IN ('LOADING', 'PREPARED', 'PREPARED')
ORDER BY LOAD_START_TIME ASC;
Step 2b: v3.4+ per-task-type CPU metrics
bash
# CPU breakdown by task type (query / load / compaction / clone / schema change)
curl -s http://<BE_IP>:<BE_HTTP_PORT>/metrics | grep "starrocks_be_cpu"

Key metrics:

  • starrocks_be_cpu_task_query — query pipeline CPU
  • starrocks_be_cpu_task_load — import write CPU
  • starrocks_be_cpu_task_compaction — compaction CPU
  • starrocks_be_cpu_task_clone — tablet clone CPU
Step 2c: perf top (function-level attribution)
bash
# Live hot functions (needs root or perf permission)
perf top -p $(pidof starrocks_be) -d 5
# Or: pstack for a quick thread snapshot without perf
pstack $(pidof starrocks_be) > /tmp/be_pstack_$(date +%s).log

3a. Query-Caused CPU Saturation

Confirm signals:

  • starrocks_be_cpu_task_query is the dominant rising metric
  • perf top shows starrocks::pipeline:: or starrocks::vectorized:: as hot functions
  • SHOW PROC '/current_queries' shows active queries with high ScanRows or MemUsageBytes

Mechanism: Query pipeline threads consume CPU proportional to data volume and operator complexity. Full-table scans (no predicate pushdown), large hash joins (hash table exceeds CPU cache), and high-cardinality aggregations all create sustained CPU pressure. Without resource group limits, a single large query can saturate all cores.

Identify the Culprit SQL
bash
# Find queries with highest scan rows in audit log (last 1 hour)
python3 scripts/analyze_logs.py "$(date -d '1 hour ago' '+%Y-%m-%d %H:%M:%S')" "$(date '+%Y-%m-%d %H:%M:%S')" "ScanRows" 5 fe.audit.log
# Or find by query execution time
grep 'QueryTime' fe.audit.log | awk -F'QueryTime=' '{print $2}' | cut -d'|' -f1 | sort -rn | head -10
Profile the Query
sql
SET is_report_success = true;
-- Re-run the query, then check profile:
-- http://<fe_ip>:8030 -> Queries -> Profile

Common query CPU causes:

Symptom in ProfileCauseFix
HASH_JOIN_NODE dominates CPULarge hash table probeForce [SHUFFLE]; collect statistics
AGGREGATE_NODE dominatesHigh-cardinality aggregationCheck streaming pre-agg; add pre-filter
OLAP_SCAN_NODE CPU high, BytesRead hugeFull scan, no pushdownFix predicate type mismatch; add index
Many pipeline threads near 100%Too many concurrent heavy queriesAdd resource group; set query_mem_limit

→ Deep-dive: [query/SKILL.md](../query/SKILL.md)


3b. Import-Caused CPU Saturation

Confirm signals:

  • starrocks_be_cpu_task_load is the dominant elevated metric
  • perf top shows starrocks::MemTable::, starrocks::SegmentWriter::, snappy::, or zstd:: as hot functions
  • Active imports visible via information_schema.loads

Mechanism: Import flush compresses memtable data before writing to disk segments. Compression (especially zstd) is CPU-intensive. With many concurrent stream loads, flush threads saturate available cores. Query pipeline threads then compete for CPU time slices, causing query latency to rise even without any change in query patterns.

Identify the Import Load
bash
# Check import thread CPU contribution
curl -s http://<BE_IP>:<BE_HTTP_PORT>/metrics | grep "starrocks_be_cpu_task_load"
# Check active imports
curl -s http://<BE_IP>:<BE_HTTP_PORT>/api/running_load | python3 -m json.tool 2>/dev/null

Common import CPU causes:

ObservationCauseFix
Many concurrent stream loadsMemtable flush compression saturating coresReduce concurrency; use lz4 instead of zstd for memtable
flush_thread_num_per_store threads all busyFlush threads competing with queryBalance flush_thread_num_per_store vs query concurrency
perf top shows snappy:: or zstd:: hotCompression CPU during flushTune compression_type for the table
Import CPU high, query CPU also highBoth competing for CPUUse resource groups to cap import CPU

→ Deep-dive: [import/SKILL.md](../import/SKILL.md)


3c. Compaction-Caused CPU Saturation

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
78
Repository forks
14
7-day trend score
0

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/starrocks/starrocks-debug-skills/cpu-saturation/badge)](https://verified-skill.com/skills/starrocks/starrocks-debug-skills/cpu-saturation)

Something wrong with this skill or its page? Tell us.