brendangregg-use-tsa
它能做什么
这个智能体可以帮你找出系统(比如服务器或应用程序)变慢或出现问题的原因。它会使用特定方法检查系统资源和任务耗时,从而找到问题的根本原因。
适用场景
- ✓当服务器或应用变慢,而你不知道原因时。
- ✓在某次变更(比如更新或负载增加)之后出现变慢的情况时。
- ✓当 CPU、内存、磁盘或网络指标看起来异常,需要解释时。
技能链接
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/brendangregg-use-tsa/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我的服务器非常慢,你能帮我查一下原因吗?”
每周 5 个新技能,1 分钟读完。
工作原理
首先,它会询问问题的具体情况。然后分析每项系统资源(CPU、内存、网络、磁盘)的利用率、饱和度和错误情况。接着,它会调查任务(线程)的时间分配,以找出瓶颈。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
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
…
常见问题
USE 和 TSA 方法是什么?
USE(Utilization 利用率、Saturation 饱和度、Errors 错误)是一种检查所有系统资源的使用率、饱和度和错误的方法。TSA(Thread State Analysis,线程状态分析)是一种分析任务时间花在哪里(执行、等待等)的方法。
“根本原因”是什么意思?
指问题发生的根本原因。找到根本原因,才能从根上彻底解决问题。
“事后复盘”报告是什么?
这是一份在事故发生后编写的文档,记录事件经过、根本原因、解决方式,以及今后如何防止类似事件再次发生。
详情
作者的原始描述
Methodical performance troubleshooting and root-cause analysis with Brendan Gregg's USE and TSA methods, plus evidence-backed RCA and postmortem reports.
热度
- GitHub 星标
- 48k
- 排名
- #4055
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
00-andruia-consultant
48k帮你的智能体启动或改进 AI 项目。它可以分析代码、推荐工具,并用西班牙语制定行动计划。
007
48k让你的智能体执行安全审计和威胁建模。它有助于保护项目免受攻击和漏洞的威胁。
10-andruia-skill-smith
48k帮你的智能体创建或改进 AI 工具。它可以定义工具的工作方式、编写文档,并验证其结构。
20-andruia-niche-intelligence
48k让你的智能体创建某个特定行业的摘要。它有助于借助可靠的信息来源,了解项目的背景、规则、使用模式和风险。