Chuyển đến nội dung
Skillpedia
Phân tích và bảng tính48k · #4055

brendangregg-use-tsa

Skill này làm gì

Agent này giúp tìm ra lý do một hệ thống (như máy chủ hoặc ứng dụng) bị chậm hoặc gặp sự cố. Nó dùng các phương pháp cụ thể để điều tra tài nguyên hệ thống và thời gian xử lý tác vụ, từ đó tìm nguyên nhân gốc rễ của vấn đề.

Khi nào nên dùng

  • ✓Khi máy chủ hoặc ứng dụng bị chậm và bạn không biết tại sao.
  • ✓Sau một thay đổi (như cập nhật hoặc tăng tải) gây ra tình trạng chậm.
  • ✓Khi các chỉ số CPU, bộ nhớ, đĩa hoặc mạng có vẻ bất thường và cần được giải thích.

Liên kết skill

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/brendangregg-use-tsa/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/brendangregg-use-tsa/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Máy chủ của tôi rất chậm, bạn có thể điều tra nguyên nhân không?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Đầu tiên, agent hỏi về vấn đề. Sau đó, nó phân tích mức sử dụng, mức độ quá tải và lỗi của từng tài nguyên hệ thống (CPU, bộ nhớ, mạng, đĩa). Tiếp theo, nó xem các tác vụ (luồng) đang dành thời gian như thế nào để tìm các điểm nghẽn.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Brendan Gregg USE+TSA Performance Analysis

Overview

A fixed, evidence-first procedure for system performance debugging, root-cause analysis (RCA), and incident reporting, distilled from Brendan Gregg's published methodologies. Instead of running whichever commands happen to be familiar, the agent poses questions first and then finds metrics to answer them: the USE Method (Utilization, Saturation, Errors) sweeps every resource, the TSA Method (Thread State Analysis) decomposes thread time, and off-CPU analysis plus flame graphs drill into what the sweeps find. Every investigation ends in a structured triage note, RCA report, or postmortem where each claim traces to a command and its output.

This skill adapts material from the community repository thecsdoctor/brendangregg-use-tsa-skill (full checklists, reference library, and report templates live there).

When to Use This Skill

  • Use when a server, VM, or container is "slow" and the cause is unknown
  • Use when latency or throughput regressed after a deploy, config change, or load shift
  • Use when CPU, memory, disk, or network metrics look abnormal and need interpretation
  • Use when an application hangs or threads pile up
  • Use when the user asks for debugging, triage, or root-cause analysis of a performance issue
  • Use when an incident needs an RCA report or a blameless postmortem with an evidence trail

How It Works

Step 0: Problem Statement

Define the problem before measuring. Ask: What makes you think there is a problem? Has it ever performed well? What changed recently (software, hardware, load)? Can it be expressed as latency or run time — quantify it. Who else is affected? What is the environment (OS, versions, config, container/VM limits)?

Step 1: 60-Second Triage (Linux)

Run the ten-command sweep, checking errors and saturation first (easiest to interpret), then utilization. Record every exonerated resource.

uptime                 # load trend (includes uninterruptible I/O on Linux)
dmesg | tail           # kernel errors: oom-killer, SYN flooding, hardware
vmstat 1               # r > CPU count = CPU saturation; si/so = swapping; wa = disk
mpstat -P ALL 1        # per-CPU imbalance (single hot CPU = single-threaded app)
pidstat 1              # per-process CPU over time
iostat -xz 1           # await (app-suffered latency), avgqu-sz, %util
free -m                # memory; buffers/cache near zero hurts
sar -n DEV 1           # NIC throughput vs link limit
sar -n TCP,ETCP 1      # active/passive connections, retransmits
top                    # spot variable load

Step 2: USE Sweep (resource-oriented)

For every resource, check Utilization, Saturation, and Errors. Iterate CPUs, memory capacity, network interfaces, storage I/O and capacity, controllers, interconnects — plus software resources (mutex locks, thread pools, process/file-descriptor capacity) and imposed limits (cgroup quotas, hypervisor caps, ulimits). Check errors before utilization. Interpretations: 100% utilization is usually a bottleneck (confirm via saturation); any non-zero saturation can be a problem; non-zero, still-increasing error counters are worth investigating; and a clean sweep is a result — it narrows the search space.

Step 3: TSA Sweep (thread-oriented)

For each thread of interest, split time into: Executing / Runnable / Anonymous Paging / Sleeping / Lock / Idle. Investigate states from most to least frequent with state-appropriate tools. If more than ~10% of time is Runnable or Anonymous Paging, fix those first — latency states can be tuned to zero. Linux instruments: /proc/PID/schedstat run_delay and perf sched latency (Runnable), vmstat si/so and per-process min_flt (Paging), offcputime/cpudist from bcc (Sleeping), /proc/lock_stat and valgrind --tool=drd (Lock), pidstat/flame graphs (Executing).

Step 4: Drill Down

Follow the biggest contributor: Executing → CPU profile + flame graph; Sleeping/Lock → off-CPU stacks (offcputime -p PID, render with flamegraph.pl --color=io); latency complaints → time-division decomposition; microservices → RED method (Rate, Errors, Duration). Prefer eBPF in-kernel aggregation over per-event dumps; start with sub-second traces in production.

Step 5: Confirm Root Cause

…

Câu hỏi thường gặp

USE và TSA là gì?

USE (Utilization, Saturation, Errors: mức sử dụng, mức bão hòa và lỗi) là phương pháp kiểm tra các chỉ số này của mọi tài nguyên hệ thống. TSA (Thread State Analysis: phân tích trạng thái luồng) là phương pháp xem các tác vụ dành thời gian của chúng vào việc gì, như đang chạy hay đang chờ.

“Nguyên nhân gốc rễ” là gì?

Đó là lý do cơ bản khiến vấn đề xảy ra. Tìm được nguyên nhân gốc rễ giúp sửa vấn đề một cách triệt để.

Báo cáo “postmortem” là gì?

Đó là tài liệu mô tả một sự cố sau khi nó xảy ra, nêu rõ chuyện gì đã diễn ra, nguyên nhân là gì, đã được xử lý thế nào và cần làm gì để sự cố không lặp lại.

Chi tiết

Mô tả gốc của tác giả

Methodical performance troubleshooting and root-cause analysis with Brendan Gregg's USE and TSA methods, plus evidence-backed RCA and postmortem reports.

repo: sickn33/agentic-awesome-skills

Độ phổ biến

Sao GitHub
48k
Vị trí xếp hạng
#4055
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự