SAP-ABAP:SAP性能分析核心工具入门——ST05/SAT/ST12等常用事务码的基础用法解析


ABAP核心进阶篇(120篇):调试与性能优化(20篇)

第十二篇:SAP性能分析核心工具入门------ST05/SAT/ST12等常用事务码的基础用法解析

博客标题:《SAP性能分析核心工具入门:ST05/SAT/ST12等常用事务码的基础用法解析》

博客简介:逐一介绍ST05 SQL追踪、SAT运行时分析、ST12性能追踪、SM50进程监控四类核心性能工具的适用场景,讲解工具的启动方式、基础参数配置、结果页面核心字段含义,附不同性能问题对应的工具选型指南,零基础也能独立完成基础性能数据采集。

📖 写在前面

上篇我们搭建了性能优化的"认知框架"------知道了问题长什么样、有哪些评估指标、排查的五步法是什么。但框架再好,没有工具就是纸上谈兵

如果说性能优化是一场侦探工作,那性能工具就是侦探的放大镜、指纹采集器和记录仪。没有这些工具,你只能凭感觉猜,而猜出来的结论大概率是错的。

本篇将逐一拆解 SAP 里最核心的 4 款性能工具,它们是 ABAP 开发者必须掌握的"性能诊断四件套":

工具 事务码 一句话定位
SQL追踪 ST05 看每条SQL执行了多久、查了多少行
运行时分析 SAT 看每个函数/代码行消耗了多少CPU
性能追踪 ST12 看一次执行的完整时间分解(最全面)
进程监控 SM50 看Work Process当前在忙什么、CPU时间多少

你不需要记住所有参数,但需要知道:遇到什么问题,选什么工具,看什么字段。本篇就是帮你建立这个直觉。
#mermaid-svg-edcjjKJobrfBeWU6{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-edcjjKJobrfBeWU6 .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-edcjjKJobrfBeWU6 .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-edcjjKJobrfBeWU6 .error-icon{fill:#552222;}#mermaid-svg-edcjjKJobrfBeWU6 .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-edcjjKJobrfBeWU6 .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-edcjjKJobrfBeWU6 .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-edcjjKJobrfBeWU6 .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-edcjjKJobrfBeWU6 .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-edcjjKJobrfBeWU6 .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-edcjjKJobrfBeWU6 .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-edcjjKJobrfBeWU6 .marker{fill:#333333;stroke:#333333;}#mermaid-svg-edcjjKJobrfBeWU6 .marker.cross{stroke:#333333;}#mermaid-svg-edcjjKJobrfBeWU6 svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-edcjjKJobrfBeWU6 p{margin:0;}#mermaid-svg-edcjjKJobrfBeWU6 .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-edcjjKJobrfBeWU6 .cluster-label text{fill:#333;}#mermaid-svg-edcjjKJobrfBeWU6 .cluster-label span{color:#333;}#mermaid-svg-edcjjKJobrfBeWU6 .cluster-label span p{background-color:transparent;}#mermaid-svg-edcjjKJobrfBeWU6 .label text,#mermaid-svg-edcjjKJobrfBeWU6 span{fill:#333;color:#333;}#mermaid-svg-edcjjKJobrfBeWU6 .node rect,#mermaid-svg-edcjjKJobrfBeWU6 .node circle,#mermaid-svg-edcjjKJobrfBeWU6 .node ellipse,#mermaid-svg-edcjjKJobrfBeWU6 .node polygon,#mermaid-svg-edcjjKJobrfBeWU6 .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-edcjjKJobrfBeWU6 .rough-node .label text,#mermaid-svg-edcjjKJobrfBeWU6 .node .label text,#mermaid-svg-edcjjKJobrfBeWU6 .image-shape .label,#mermaid-svg-edcjjKJobrfBeWU6 .icon-shape .label{text-anchor:middle;}#mermaid-svg-edcjjKJobrfBeWU6 .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-edcjjKJobrfBeWU6 .rough-node .label,#mermaid-svg-edcjjKJobrfBeWU6 .node .label,#mermaid-svg-edcjjKJobrfBeWU6 .image-shape .label,#mermaid-svg-edcjjKJobrfBeWU6 .icon-shape .label{text-align:center;}#mermaid-svg-edcjjKJobrfBeWU6 .node.clickable{cursor:pointer;}#mermaid-svg-edcjjKJobrfBeWU6 .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-edcjjKJobrfBeWU6 .arrowheadPath{fill:#333333;}#mermaid-svg-edcjjKJobrfBeWU6 .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-edcjjKJobrfBeWU6 .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-edcjjKJobrfBeWU6 .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-edcjjKJobrfBeWU6 .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-edcjjKJobrfBeWU6 .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-edcjjKJobrfBeWU6 .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-edcjjKJobrfBeWU6 .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-edcjjKJobrfBeWU6 .cluster text{fill:#333;}#mermaid-svg-edcjjKJobrfBeWU6 .cluster span{color:#333;}#mermaid-svg-edcjjKJobrfBeWU6 div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-edcjjKJobrfBeWU6 .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-edcjjKJobrfBeWU6 rect.text{fill:none;stroke-width:0;}#mermaid-svg-edcjjKJobrfBeWU6 .icon-shape,#mermaid-svg-edcjjKJobrfBeWU6 .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-edcjjKJobrfBeWU6 .icon-shape p,#mermaid-svg-edcjjKJobrfBeWU6 .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-edcjjKJobrfBeWU6 .icon-shape .label rect,#mermaid-svg-edcjjKJobrfBeWU6 .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-edcjjKJobrfBeWU6 .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-edcjjKJobrfBeWU6 .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-edcjjKJobrfBeWU6 :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 性能诊断四件套
ST05 SQL追踪

每条SQL的执行细节
SAT 运行时分析

每个函数的CPU时间
ST12 性能追踪

全链路时间分解
SM50 进程监控

实时Work Process状态
全表扫描 / 循环内SELECT

FOR ALL ENTRIES检查
热点函数 / CPU密集代码

内存分配分析
第一次排查首选

时间分解一目了然
系统整体卡慢

定位资源占用进程

本篇学习目标

  • 4款核心工具的启动方式、适用场景、结果解读
  • 不同性能问题对应的工具选型指南
  • 从零开始独立完成一次完整的性能数据采集
  • 理解"追踪文件"的概念和管理方式

前置阅读 :建议先读第一篇《运行时性能基础入门》,里面的时间构成和排查五步法是本篇的基础。

适用版本:SAP NetWeaver 7.51+

一、工具总览与选型指南

🎯 1.1 四款工具定位对比

维度 ST05 SAT ST12 SM50
追踪对象 数据库操作 ABAP代码执行 全链路(推荐) Work Process进程
核心关注点 SQL语句 函数/代码块 时间分解明细 实时进程状态
适合场景 慢SQL/全表扫描/循环内SELECT CPU密集程序/循环算法问题/内存分析 初次排查(不知道瓶颈在哪)/前后端全链路 系统整体卡顿/锁表/长事务排查
启动方式 手动开→触发操作→停止→分析 SE30/SAT录制→停止→分析 ST12开→触发操作→停止→分析 实时查看,无需启动
输出粒度 每条SQL的执行 每个函数/语句的CPU时间 组件级时间分解+SQL+ABAP热点 每个Work Process的状态和CPU时间

🎯 1.2 选型决策树(遇到问题看这个)

#mermaid-svg-dMOVcnVpu5U2AkaP{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-dMOVcnVpu5U2AkaP .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-dMOVcnVpu5U2AkaP .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-dMOVcnVpu5U2AkaP .error-icon{fill:#552222;}#mermaid-svg-dMOVcnVpu5U2AkaP .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-dMOVcnVpu5U2AkaP .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-dMOVcnVpu5U2AkaP .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-dMOVcnVpu5U2AkaP .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-dMOVcnVpu5U2AkaP .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-dMOVcnVpu5U2AkaP .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-dMOVcnVpu5U2AkaP .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-dMOVcnVpu5U2AkaP .marker{fill:#333333;stroke:#333333;}#mermaid-svg-dMOVcnVpu5U2AkaP .marker.cross{stroke:#333333;}#mermaid-svg-dMOVcnVpu5U2AkaP svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-dMOVcnVpu5U2AkaP p{margin:0;}#mermaid-svg-dMOVcnVpu5U2AkaP .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-dMOVcnVpu5U2AkaP .cluster-label text{fill:#333;}#mermaid-svg-dMOVcnVpu5U2AkaP .cluster-label span{color:#333;}#mermaid-svg-dMOVcnVpu5U2AkaP .cluster-label span p{background-color:transparent;}#mermaid-svg-dMOVcnVpu5U2AkaP .label text,#mermaid-svg-dMOVcnVpu5U2AkaP span{fill:#333;color:#333;}#mermaid-svg-dMOVcnVpu5U2AkaP .node rect,#mermaid-svg-dMOVcnVpu5U2AkaP .node circle,#mermaid-svg-dMOVcnVpu5U2AkaP .node ellipse,#mermaid-svg-dMOVcnVpu5U2AkaP .node polygon,#mermaid-svg-dMOVcnVpu5U2AkaP .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-dMOVcnVpu5U2AkaP .rough-node .label text,#mermaid-svg-dMOVcnVpu5U2AkaP .node .label text,#mermaid-svg-dMOVcnVpu5U2AkaP .image-shape .label,#mermaid-svg-dMOVcnVpu5U2AkaP .icon-shape .label{text-anchor:middle;}#mermaid-svg-dMOVcnVpu5U2AkaP .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-dMOVcnVpu5U2AkaP .rough-node .label,#mermaid-svg-dMOVcnVpu5U2AkaP .node .label,#mermaid-svg-dMOVcnVpu5U2AkaP .image-shape .label,#mermaid-svg-dMOVcnVpu5U2AkaP .icon-shape .label{text-align:center;}#mermaid-svg-dMOVcnVpu5U2AkaP .node.clickable{cursor:pointer;}#mermaid-svg-dMOVcnVpu5U2AkaP .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-dMOVcnVpu5U2AkaP .arrowheadPath{fill:#333333;}#mermaid-svg-dMOVcnVpu5U2AkaP .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-dMOVcnVpu5U2AkaP .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-dMOVcnVpu5U2AkaP .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-dMOVcnVpu5U2AkaP .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-dMOVcnVpu5U2AkaP .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-dMOVcnVpu5U2AkaP .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-dMOVcnVpu5U2AkaP .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-dMOVcnVpu5U2AkaP .cluster text{fill:#333;}#mermaid-svg-dMOVcnVpu5U2AkaP .cluster span{color:#333;}#mermaid-svg-dMOVcnVpu5U2AkaP div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-dMOVcnVpu5U2AkaP .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-dMOVcnVpu5U2AkaP rect.text{fill:none;stroke-width:0;}#mermaid-svg-dMOVcnVpu5U2AkaP .icon-shape,#mermaid-svg-dMOVcnVpu5U2AkaP .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-dMOVcnVpu5U2AkaP .icon-shape p,#mermaid-svg-dMOVcnVpu5U2AkaP .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-dMOVcnVpu5U2AkaP .icon-shape .label rect,#mermaid-svg-dMOVcnVpu5U2AkaP .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-dMOVcnVpu5U2AkaP .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-dMOVcnVpu5U2AkaP .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-dMOVcnVpu5U2AkaP :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 是

不知道
知道


你遇到的是哪类问题?
系统整体卡慢?
SM50

看哪个Work Process占用CPU最高
某个特定操作慢?
知道瓶颈在哪?
ST12

全面追踪一次,时间分解一目了然
怀疑是SQL慢?
ST05

看每条SQL执行时间
SAT

看函数CPU时间

一句话选型口诀

  • 「全不知道」→ ST12(先来一把全链路追踪)
  • 「查数据库」→ ST05
  • 「查代码」→ SAT
  • 「看整体」→ SM50

推荐排查流程(和第一篇五步法对应)

  • 第2步「瓶颈定位」→ 先用 ST12 做一次完整追踪
  • 第3步「根因分析」→ 如果DB占比高 → 用 ST05 查具体哪条SQL;如果CPU占比高 → 用 SAT 查具体哪个函数

二、ST05 SQL追踪

🔍 2.1 ST05是什么

ST05 记录一段时间内程序执行的每一条数据库操作(SELECT / INSERT / UPDATE / DELETE等),精确回答"程序都查了哪些表、每条SQL花了多久"。

适用场景:怀疑某条SQL特别慢、想确认是否有循环内嵌套SELECT、想看SQL的执行计划(走索引还是全表扫描)、验证优化后的SQL是否真的变快了。

不适用场景:想看ABAP代码的CPU时间(用SAT)、想做完整时间分解(用ST12)。

🔍 2.2 ST05启动与参数配置

操作流程 :输入事务码 ST05 → 勾选"SQL Trace (1)" → 点击过滤(Filter)填写用户名(⚠️一定要填,否则会把整个系统所有人的SQL都追踪下来 )→ 点击激活Trace → 切换到另一个窗口执行你的操作 → 操作完成后立刻回到ST05点击停止Trace → 点击显示Trace查看结果。

关键提醒:追踪时间建议不超过1分钟,追踪文件会持续增长。

🔍 2.3 ST05结果解读

解读技巧 操作方法
按持续时间倒序 点击表头排序,找到最慢的TOP 5条。返回几十万行的SELECT大概率是全表扫描
看执行次数 同一条SQL被执行几千次 → 循环内嵌套SELECT。单次5ms×1000次=5秒
看记录数 返回几万行以上要特别警惕,正常业务场景不会返回这么多行
双击语句行 查看完整SQL文本、WHERE条件、调用位置
查看执行计划 选中语句行 → Ctrl+Shift+F12。Access type: Sorted Table Scan = 全表扫描;Index Only Scan = 走了索引
FOR ALL ENTRIES检查 展开语句看IN条件有多少个值。几千个值 → 内表没去重

🔍 2.4 ST05进阶功能

功能 说明
追踪结果过滤与分组 按表名过滤、按SQL类型分组(看SELECT/UPDATE/DELETE各有多少耗时)
比较两次追踪 优化前后各做一次追踪,Menu → Compare → Trace Files,自动对比差异
Buffer Trace 勾选"Buffer Trace (4)",看数据是从数据库读还是从表缓冲读
Enqueue Trace 勾选"Enqueue Trace (2)",看锁等待导致的性能问题,配合SM12效果更好
RFC Trace 勾选"RFC Trace (3)",查看RFC调用时间,适合排查跨系统性能问题

三、SAT运行时分析

⚡ 3.1 SAT是什么

SAT记录程序执行过程中每个ABAP函数/代码块消耗的CPU时间,精确回答"CPU时间花在哪个函数/代码上了"。新SAP版本推荐用SAT,功能更全、界面更现代;SE30是兼容方案。

适用场景:ST12显示CPU时间占比高、怀疑循环/算法/字符串操作等纯ABAP逻辑问题、想看函数被调用多少次、分析内存分配问题、做代码覆盖度分析。

⚡ 3.2 SAT启动与参数配置

操作流程 :输入事务码 SAT → 选择测量方式(推荐Direct execution,直接在SAT里填写程序名,程序结束后自动停止测量)→ 点击Evaluation Variant 选择变体(推荐SAT_ALL_MEASUREMENTS,包含所有测量项)→ 点击Start Measurement自动启动程序 → 程序运行完SAT自动弹出结果页面。

关键提醒:SAT默认追踪整个程序运行过程,如果程序要跑好几分钟SAT也会等那么久。SAT文件存在系统里,超过7天会自动删除。

⚡ 3.3 SAT结果解读(三个核心视图)

视图一:热点列表(Hotspot List)------⭐ 最重要

按总CPU时间排序,显示Top N个"最耗CPU"的函数/代码块。Top 1函数被调用12345次占45% CPU → 大概率在循环里;Top 2方法总时间2000ms调用1次 → 单次执行就慢需要看源码。

视图二:聚合语句(Aggregated Statements)

按语句类型汇总CPU时间。如果READ TABLE占45.6% → 大部分时间花在内表查找上 → 应该用SORT + BINARY SEARCH或TYPE HASHED TABLE让查找从O(N)变O(logN)/O(1)。

视图三:代码覆盖(Code Coverage)------⭐ 也很实用

点击具体程序可看到每一行代码是否被执行、执行了多少次、耗时多少。在代码行上点击行号还可看到这行的具体CPU时间。

⚡ 3.4 SAT进阶:内存分析

SAT不仅能测CPU时间,还能追踪内存分配和释放。启动时勾选"Memory measurements",结果页面的Memory Analysis标签可看到:哪些数据对象占用内存最大、内存分配/释放的时间点、内存增长曲线、哪些内存分配后一直未释放(疑似泄漏)。

四、ST12性能追踪

📊 4.1 ST12是什么

ST12是最全面 的性能追踪工具,能同时追踪SQL + ABAP + RFC + 锁 + 缓冲,核心价值是一站式全景视图,第一次排查性能问题时首选。
#mermaid-svg-QEnhpAHUuoc5pqZh{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-QEnhpAHUuoc5pqZh .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-QEnhpAHUuoc5pqZh .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-QEnhpAHUuoc5pqZh .error-icon{fill:#552222;}#mermaid-svg-QEnhpAHUuoc5pqZh .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-QEnhpAHUuoc5pqZh .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-QEnhpAHUuoc5pqZh .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-QEnhpAHUuoc5pqZh .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-QEnhpAHUuoc5pqZh .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-QEnhpAHUuoc5pqZh .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-QEnhpAHUuoc5pqZh .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-QEnhpAHUuoc5pqZh .marker{fill:#333333;stroke:#333333;}#mermaid-svg-QEnhpAHUuoc5pqZh .marker.cross{stroke:#333333;}#mermaid-svg-QEnhpAHUuoc5pqZh svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-QEnhpAHUuoc5pqZh p{margin:0;}#mermaid-svg-QEnhpAHUuoc5pqZh .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-QEnhpAHUuoc5pqZh .cluster-label text{fill:#333;}#mermaid-svg-QEnhpAHUuoc5pqZh .cluster-label span{color:#333;}#mermaid-svg-QEnhpAHUuoc5pqZh .cluster-label span p{background-color:transparent;}#mermaid-svg-QEnhpAHUuoc5pqZh .label text,#mermaid-svg-QEnhpAHUuoc5pqZh span{fill:#333;color:#333;}#mermaid-svg-QEnhpAHUuoc5pqZh .node rect,#mermaid-svg-QEnhpAHUuoc5pqZh .node circle,#mermaid-svg-QEnhpAHUuoc5pqZh .node ellipse,#mermaid-svg-QEnhpAHUuoc5pqZh .node polygon,#mermaid-svg-QEnhpAHUuoc5pqZh .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-QEnhpAHUuoc5pqZh .rough-node .label text,#mermaid-svg-QEnhpAHUuoc5pqZh .node .label text,#mermaid-svg-QEnhpAHUuoc5pqZh .image-shape .label,#mermaid-svg-QEnhpAHUuoc5pqZh .icon-shape .label{text-anchor:middle;}#mermaid-svg-QEnhpAHUuoc5pqZh .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-QEnhpAHUuoc5pqZh .rough-node .label,#mermaid-svg-QEnhpAHUuoc5pqZh .node .label,#mermaid-svg-QEnhpAHUuoc5pqZh .image-shape .label,#mermaid-svg-QEnhpAHUuoc5pqZh .icon-shape .label{text-align:center;}#mermaid-svg-QEnhpAHUuoc5pqZh .node.clickable{cursor:pointer;}#mermaid-svg-QEnhpAHUuoc5pqZh .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-QEnhpAHUuoc5pqZh .arrowheadPath{fill:#333333;}#mermaid-svg-QEnhpAHUuoc5pqZh .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-QEnhpAHUuoc5pqZh .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-QEnhpAHUuoc5pqZh .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-QEnhpAHUuoc5pqZh .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-QEnhpAHUuoc5pqZh .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-QEnhpAHUuoc5pqZh .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-QEnhpAHUuoc5pqZh .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-QEnhpAHUuoc5pqZh .cluster text{fill:#333;}#mermaid-svg-QEnhpAHUuoc5pqZh .cluster span{color:#333;}#mermaid-svg-QEnhpAHUuoc5pqZh div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-QEnhpAHUuoc5pqZh .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-QEnhpAHUuoc5pqZh rect.text{fill:none;stroke-width:0;}#mermaid-svg-QEnhpAHUuoc5pqZh .icon-shape,#mermaid-svg-QEnhpAHUuoc5pqZh .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-QEnhpAHUuoc5pqZh .icon-shape p,#mermaid-svg-QEnhpAHUuoc5pqZh .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-QEnhpAHUuoc5pqZh .icon-shape .label rect,#mermaid-svg-QEnhpAHUuoc5pqZh .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-QEnhpAHUuoc5pqZh .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-QEnhpAHUuoc5pqZh .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-QEnhpAHUuoc5pqZh :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 是


ST12 全链路追踪
DB占比高?
ST05 查具体SQL
CPU占比高?
SAT 查具体函数
输出:时间分解明细

DB Time / CPU Time / Wait Time / RFC Time

适用场景:第一次排查不知道瓶颈在哪、想得到完整的时间分解、做前后端全链路追踪、对比优化效果。

📊 4.2 ST12启动与操作

输入事务码 ST12 → 填写用户名 → 勾选所有需要追踪的时间类型(Database Time、ABAP Time、Wait Time、RFC Time)→ 点击Start Trace → 切换窗口执行操作 → 操作完成回到ST12点击End Trace → 点击Display Trace查看结果。

关键提醒:ST12追踪的是从Start到End之间所有执行(你的会话),所以Start之后尽快执行操作,End之后尽快查看,建议追踪时间不超过1分钟。

📊 4.3 ST12结果解读

最重要的视图是Time Aggregation(时间分解)

例如总响应时间12,345ms中,Database Time占9,876ms(80%)→ 瓶颈在数据库 → 下一步用ST05查具体哪条SQL。如果DB占20%、CPU占80% → 瓶颈在ABAP逻辑 → 下一步用SAT查热点函数。

ST12还支持对比两次追踪(优化前后),自动显示时间差异,高亮变化最大的组件。

五、SM50进程监控

🖥️ 5.1 SM50是什么

SM50实时 查看SAP系统所有Work Process的运行状态。与ST05/SAT/ST12的"事后追踪"不同,SM50是实时监控------打开就能看到当前系统每个进程在干什么,适合"系统突然卡了,想知道谁在占用资源"这类场景。

🖥️ 5.2 SM50结果解读

字段 含义
Typ 进程类型:DIA(对话)、BTC(后台)、ENQ(锁)、BGDI(后台对话)
State Run = 正在执行;Wait = 空闲/等待
CPU Time 累计CPU时间(毫秒),数值越大越耗资源
Program / Trans 当前正在执行的程序名或事务码
User 哪个用户触发的这个进程

快速诊断技巧

  • 找CPU时间特别高的进程 → 全系统卡了大概率是那个进程在占CPU
  • 看有多少进程是Run状态 → 8个Work Process中6-7个在Run说明系统资源紧张
  • 看有没有"僵尸进程" → State一直是Run但CPU时间不增长,可能锁死了,配合SM12查看
  • 看哪些用户占用资源多 → 找那个用户问一下在做什么

六、辅助工具与事务码速查

类型 事务码 用途
核心 ST05 / SAT(SE30) / ST12 / SM50 本篇详解的四件套
时间监控 STAD / STAT 单个事务/程序的响应时间分解(最基础时间数据)
ST03N 系统负载历史快照(看过去1小时/1天的趋势)
SM51 服务器状态总览(多服务器时看整体)
锁管理 SM12 锁管理(查锁表、锁等待、长事务)
SM13 锁等待历史(已释放的锁等待记录)
内存 ST06 / ST07 操作系统级/内存管理器历史快照
缓冲 ST02 / ST10 缓冲状态(Table Buffer、Program Buffer命中率)
/$SYNC 手动刷新所有缓冲(调试时偶尔需要)
诊断 ST22 ABAP短Dump分析(内存溢出在这里看)
SCI / SCIF Code Inspector(静态代码检查,开发阶段发现反模式)
后台 SM37 后台作业监控(历史运行记录、耗时、状态)

七、不同问题场景完整流程示例

📋 7.1 场景一:报表运行超时

#mermaid-svg-UAsK71DRYNIsVtjv{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-UAsK71DRYNIsVtjv .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-UAsK71DRYNIsVtjv .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-UAsK71DRYNIsVtjv .error-icon{fill:#552222;}#mermaid-svg-UAsK71DRYNIsVtjv .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-UAsK71DRYNIsVtjv .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-UAsK71DRYNIsVtjv .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-UAsK71DRYNIsVtjv .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-UAsK71DRYNIsVtjv .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-UAsK71DRYNIsVtjv .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-UAsK71DRYNIsVtjv .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-UAsK71DRYNIsVtjv .marker{fill:#333333;stroke:#333333;}#mermaid-svg-UAsK71DRYNIsVtjv .marker.cross{stroke:#333333;}#mermaid-svg-UAsK71DRYNIsVtjv svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-UAsK71DRYNIsVtjv p{margin:0;}#mermaid-svg-UAsK71DRYNIsVtjv .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-UAsK71DRYNIsVtjv .cluster-label text{fill:#333;}#mermaid-svg-UAsK71DRYNIsVtjv .cluster-label span{color:#333;}#mermaid-svg-UAsK71DRYNIsVtjv .cluster-label span p{background-color:transparent;}#mermaid-svg-UAsK71DRYNIsVtjv .label text,#mermaid-svg-UAsK71DRYNIsVtjv span{fill:#333;color:#333;}#mermaid-svg-UAsK71DRYNIsVtjv .node rect,#mermaid-svg-UAsK71DRYNIsVtjv .node circle,#mermaid-svg-UAsK71DRYNIsVtjv .node ellipse,#mermaid-svg-UAsK71DRYNIsVtjv .node polygon,#mermaid-svg-UAsK71DRYNIsVtjv .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-UAsK71DRYNIsVtjv .rough-node .label text,#mermaid-svg-UAsK71DRYNIsVtjv .node .label text,#mermaid-svg-UAsK71DRYNIsVtjv .image-shape .label,#mermaid-svg-UAsK71DRYNIsVtjv .icon-shape .label{text-anchor:middle;}#mermaid-svg-UAsK71DRYNIsVtjv .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-UAsK71DRYNIsVtjv .rough-node .label,#mermaid-svg-UAsK71DRYNIsVtjv .node .label,#mermaid-svg-UAsK71DRYNIsVtjv .image-shape .label,#mermaid-svg-UAsK71DRYNIsVtjv .icon-shape .label{text-align:center;}#mermaid-svg-UAsK71DRYNIsVtjv .node.clickable{cursor:pointer;}#mermaid-svg-UAsK71DRYNIsVtjv .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-UAsK71DRYNIsVtjv .arrowheadPath{fill:#333333;}#mermaid-svg-UAsK71DRYNIsVtjv .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-UAsK71DRYNIsVtjv .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-UAsK71DRYNIsVtjv .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-UAsK71DRYNIsVtjv .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-UAsK71DRYNIsVtjv .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-UAsK71DRYNIsVtjv .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-UAsK71DRYNIsVtjv .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-UAsK71DRYNIsVtjv .cluster text{fill:#333;}#mermaid-svg-UAsK71DRYNIsVtjv .cluster span{color:#333;}#mermaid-svg-UAsK71DRYNIsVtjv div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-UAsK71DRYNIsVtjv .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-UAsK71DRYNIsVtjv rect.text{fill:none;stroke-width:0;}#mermaid-svg-UAsK71DRYNIsVtjv .icon-shape,#mermaid-svg-UAsK71DRYNIsVtjv .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-UAsK71DRYNIsVtjv .icon-shape p,#mermaid-svg-UAsK71DRYNIsVtjv .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-UAsK71DRYNIsVtjv .icon-shape .label rect,#mermaid-svg-UAsK71DRYNIsVtjv .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-UAsK71DRYNIsVtjv .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-UAsK71DRYNIsVtjv .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-UAsK71DRYNIsVtjv :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} STAT 确认问题

平均300秒,常态
ST12 全链路

DB Time占82%
ST05 查最慢SQL

全表扫描 + 循环内SELECT
修复

加索引 + 去掉循环内SELECT
ST12/STAT 验证

300秒→18秒 ✅

📋 7.2 场景二:系统整体卡慢

立刻打开SM50 → 看到8个Work Process中7个是Run状态 → BTC进程CPU时间异常高 → SM37确认该后台作业每小时跑一次、每次45分钟 → 联系DBA在业务高峰前临时终止,等低峰期用SAT追踪优化。

📋 7.3 场景三:程序CPU时间高(ABAP逻辑问题)

ST12显示CPU时间占70% → 开SAT追踪 → 热点列表显示某函数被调用50000次占55% CPU,READ TABLE语句占30% → 内表未排序导致线性查找 → 优化为SORT + BINARY SEARCH或TYPE HASHED TABLE。

八、常见问题与排查

# 问题 解决方案
Q1 工具没有权限 ST05/ST12需要S_ADMI_FCD权限;SM50需要S_BTCH_NAM。联系basis开通或请有权限同事协助
Q2 追踪文件存在哪里?会自动删除吗? ST05/ST12存在系统工作目录,SAT存在数据库表,均默认7天后自动删除。重要文件Ctrl+S导出本地保存
Q3 追踪会影响系统性能吗? 正常使用(<1分钟)影响可忽略。生产环境建议低峰期使用,追踪时间控制在1分钟内
Q4 ST05追踪不到东西? 检查是否激活、过滤条件是否把自己过滤掉了、是否在同一Work Process执行操作、是否是异步/后台程序
Q5 SAT和SE30用哪个? SAT是新版界面功能更全(Memory Analyzer、Code Coverage),SE30是兼容方案

九、总结

#mermaid-svg-Sqphtd9VnkRLu0zB{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-Sqphtd9VnkRLu0zB .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-Sqphtd9VnkRLu0zB .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-Sqphtd9VnkRLu0zB .error-icon{fill:#552222;}#mermaid-svg-Sqphtd9VnkRLu0zB .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-Sqphtd9VnkRLu0zB .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-Sqphtd9VnkRLu0zB .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-Sqphtd9VnkRLu0zB .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-Sqphtd9VnkRLu0zB .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-Sqphtd9VnkRLu0zB .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-Sqphtd9VnkRLu0zB .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-Sqphtd9VnkRLu0zB .marker{fill:#333333;stroke:#333333;}#mermaid-svg-Sqphtd9VnkRLu0zB .marker.cross{stroke:#333333;}#mermaid-svg-Sqphtd9VnkRLu0zB svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-Sqphtd9VnkRLu0zB p{margin:0;}#mermaid-svg-Sqphtd9VnkRLu0zB .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-Sqphtd9VnkRLu0zB .cluster-label text{fill:#333;}#mermaid-svg-Sqphtd9VnkRLu0zB .cluster-label span{color:#333;}#mermaid-svg-Sqphtd9VnkRLu0zB .cluster-label span p{background-color:transparent;}#mermaid-svg-Sqphtd9VnkRLu0zB .label text,#mermaid-svg-Sqphtd9VnkRLu0zB span{fill:#333;color:#333;}#mermaid-svg-Sqphtd9VnkRLu0zB .node rect,#mermaid-svg-Sqphtd9VnkRLu0zB .node circle,#mermaid-svg-Sqphtd9VnkRLu0zB .node ellipse,#mermaid-svg-Sqphtd9VnkRLu0zB .node polygon,#mermaid-svg-Sqphtd9VnkRLu0zB .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-Sqphtd9VnkRLu0zB .rough-node .label text,#mermaid-svg-Sqphtd9VnkRLu0zB .node .label text,#mermaid-svg-Sqphtd9VnkRLu0zB .image-shape .label,#mermaid-svg-Sqphtd9VnkRLu0zB .icon-shape .label{text-anchor:middle;}#mermaid-svg-Sqphtd9VnkRLu0zB .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-Sqphtd9VnkRLu0zB .rough-node .label,#mermaid-svg-Sqphtd9VnkRLu0zB .node .label,#mermaid-svg-Sqphtd9VnkRLu0zB .image-shape .label,#mermaid-svg-Sqphtd9VnkRLu0zB .icon-shape .label{text-align:center;}#mermaid-svg-Sqphtd9VnkRLu0zB .node.clickable{cursor:pointer;}#mermaid-svg-Sqphtd9VnkRLu0zB .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-Sqphtd9VnkRLu0zB .arrowheadPath{fill:#333333;}#mermaid-svg-Sqphtd9VnkRLu0zB .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-Sqphtd9VnkRLu0zB .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-Sqphtd9VnkRLu0zB .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-Sqphtd9VnkRLu0zB .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-Sqphtd9VnkRLu0zB .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-Sqphtd9VnkRLu0zB .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-Sqphtd9VnkRLu0zB .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-Sqphtd9VnkRLu0zB .cluster text{fill:#333;}#mermaid-svg-Sqphtd9VnkRLu0zB .cluster span{color:#333;}#mermaid-svg-Sqphtd9VnkRLu0zB div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-Sqphtd9VnkRLu0zB .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-Sqphtd9VnkRLu0zB rect.text{fill:none;stroke-width:0;}#mermaid-svg-Sqphtd9VnkRLu0zB .icon-shape,#mermaid-svg-Sqphtd9VnkRLu0zB .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-Sqphtd9VnkRLu0zB .icon-shape p,#mermaid-svg-Sqphtd9VnkRLu0zB .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-Sqphtd9VnkRLu0zB .icon-shape .label rect,#mermaid-svg-Sqphtd9VnkRLu0zB .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-Sqphtd9VnkRLu0zB .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-Sqphtd9VnkRLu0zB .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-Sqphtd9VnkRLu0zB :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} DB占比高
CPU占比高
黄金排查流程

  1. STAT

快速确认问题
2. ST12

全链路定位瓶颈
瓶颈在哪?
3. ST05

查具体SQL
3. SAT

查热点函数
4. 修复后

ST12对比验证

工具 事务码 最适合场景
SQL追踪 ST05 怀疑有慢SQL/全表扫描
运行时分析 SAT 怀疑ABAP逻辑问题
性能追踪 ST12 不知道瓶颈在哪的第一次排查
进程监控 SM50 系统整体卡慢

核心要点

  1. 先看整体,再看细节:STAT确认问题 → ST12全景定位 → ST05/SAT精准打击
  2. 数据驱动,不凭感觉:每次优化前后都要用工具对比验证
  3. 生产谨慎,测试随意:生产环境追踪控制在1分钟内且避开高峰
  4. 工具是手段,不是目的:追踪的目的是找到瓶颈并优化,不要沉迷于看数据

下一篇预告:《数据库访问性能优化:全表扫描、低效JOIN、重复查询的根因与解决方案》

作者:爱喝水的鱼丶

版本记录:2026年8月

💬 你在使用这些性能工具时有什么技巧或踩过什么坑?欢迎在评论区分享------好工具用好才能发挥价值!

相关推荐
FungLeo2 小时前
Flutter 带 TTL 的多级缓存设计:内存+磁盘+网络三层实战
网络·flutter·缓存·性能优化
人间凡尔赛3 小时前
React Compiler 1.0 正式落地:告别 useMemo / useCallback,2026 前端性能优化的新范式
前端·性能优化·react
肥胖小羊19 小时前
企业微信机器人系统:架构设计、多场景应用与性能优化实战
性能优化·企业微信
云端漫步19871 天前
HarmonyOS NEXT AI 智能生活助手:性能优化
华为·性能优化·生活·harmonyos
做好一个小前端1 天前
ECharts 折线图大数据量性能优化参考
前端·性能优化·echarts
UWA2 天前
隐藏视频变“常驻刺客”,VideoPlayer与“N/A”纹理该怎么查
人工智能·性能优化·音视频·memory·cpu·游戏开发
烬羽2 天前
《React Router 受保护路由的 3 个坑,第 2 个 90% 的人都踩过》
react.js·性能优化·全栈
李恒-聆机智能专精数采2 天前
新网站在搜索引擎完全搜不到怎么优化?(一)
前端·搜索引擎·性能优化·制造·ai编程·程序员创富
张龙6872 天前
10 万条数据不卡顿:不定高虚拟列表从原理到生产实现
前端·javascript·性能优化