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.mdSao 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
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
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.
Độ 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
Bình luận
- …
Thêm skill từ kho mã này
00-andruia-consultant
48kGiúp agent của bạn bắt đầu hoặc cải thiện các dự án AI. Phân tích mã, gợi ý công cụ và lập kế hoạch hành động bằng tiếng Tây Ban Nha.
007
48kCho phép agent của bạn thực hiện kiểm toán bảo mật và mô hình hóa mối đe dọa. Hữu ích để bảo vệ dự án khỏi các cuộc tấn công và lỗ hổng.
10-andruia-skill-smith
48kGiúp agent của bạn tạo hoặc cải thiện các công cụ AI. Xác định cách công cụ hoạt động, viết tài liệu và kiểm tra cấu trúc.
20-andruia-niche-intelligence
48kGiúp agent của bạn tạo bản tóm tắt về một ngành cụ thể. Hữu ích để hiểu bối cảnh, quy tắc, cách người dùng tương tác và rủi ro của dự án.
Skill tương tự
gitcrawl
394kCho phép agent của bạn tìm trong kho lưu trữ issue và pull request GitHub, gom các mục trùng lặp và kiểm tra trạng thái hiện tại trên GitHub.
slacrawl
394kCho phép agent của bạn tìm và đếm tin nhắn trong kho lưu trữ Slack cục bộ, kiểm tra kho đó mới đến mức nào và làm mới khi cần.
goplaces
394kGiúp agent của bạn tìm địa điểm, lấy chi tiết và đánh giá, và xác định tên địa điểm bằng Google Places, với đầu ra JSON cho script.