GaussDB 数据库架构师修炼(八) 等待事件(2)-ASP报告分析

发布于:2025-07-28 ⋅ 阅读:(14) ⋅ 点赞:(0)

1  ASP报告简介

       ASP-Active Sesion Profile (活跃会话档案信息),ASP每秒获取活跃会话事件,放到内存中,内存中的数据达阈值,会落盘gs_asp表中。ASP Report根据输入的时间段与slot个数,从内存和磁盘中取数据可视化到html中。

2 生成ASP报各-GUC参数说明

ASP相关GUC参数

GUC参数  默认值 说明
enable_asp                on 是否开启活跃会话信息active session profile 
enable_asp_standby on 是否开启备机ASP功能
asp_sample_num 100000 LOCAL_ACTIVE_SESSION视图最大的样本个数,仅sysadmin用户可以访问
asp_sample_interval 1 每次采样的间隔
asp_flush_interval         300 ASP定时刷盘时间间隔
asp_flush_rate 10 当内存中样本个数达到asp_sample_num时,会按一定比例把内存中样本刷新到磁盘上,asp_flash_rate为刷新比例。该参数为10时表表按10:1进行刷新。
asp_flush_mode 'table' ASP刷新到磁盘上的方式分为写文件和写系统表
asp_retention_days 2 当ASP样本写到系统表时,该参数表示保留的最大天数
asp_log_filename "asp-%Y-%m-%d_%H%M%S.log" 当ASP写文件时,该参数设置文件名的格式,仅sysadmin用户可以访问

3 生成ASP报告

1) 内核生成asp报告步骤:

步骤1: 用gsql方试连接数据库,切换至postgres库。

步骤2:输入\a \t \o 报告路径(/data1/asp.html)

步骤3:生成ASP报告

  • 集中式:

select generate_asp_report(start_time timestamp with time zone,end_time timestamp with time zone,slot_count bigint,node_name text);

  •   分布式:

select dbe_perf.generate_asp_report(start_time timestamp with time zone, end_time timestamp with time zone,nodename text,slot_count bigint);

参数 说明 取值范围
start_time 需要生成报告的开始时间 时间戳类型
end_time   需要生成报告的结束时间 时间戳类型
slot_count         指标展示时分割的时间段的个数

整型:

1~9900719925474099

node_name 指定生成某个节点的ASP报告 字符串类型

例如:

gaussdb=>\t \a \o /home/Ruby/asp0727.html
Output format is unaligned.
Showing only tuples.
gaussdb=> select generate_asp_report('2025-07-27 22:30:00','2025-07-27 23:00:00',2,'dn_6001');

2)tpops生成asp报告

选择目标实例->诊断优化->性能报告->ASP报告。

 4 ASP报告优化案例分析

1)集群实际负载:

2)TOP EVENT GRAPH

 

3) Top Sessions with top Event

 

4)  Top SQL with top event

定位到SQLID,进行分析。

5 批注

ASP报告是等待事件的一张可视化的视图,方便我们分析性能瓶颈提供参考依据。

 


网站公告

今日签到

点亮在社区的每一天
去签到