等待事件介绍
有关等待事件的信息显示如下三个动态性能视图中:
V$SESSION_WAIT:显示会话刚刚完成等待或当前正在等待的事件。V$SYSTEM_EVENT:显示当前租户中所有等待事件的总数。V$SESSION_EVENT:类似于V$SYSTEM_EVENT,但显示每个会话的所有等待事件。
许多等待事件与内部实现相关联,因此可能会有更改或删除,具体以实际情况为准。
等待事件类型
每个等待事件都属于一类等待事件。等待事件主要分为如下几个类型:
- Administrative 由 DBA 命令导致的用户等待事件(例如:索引重建)。
- Application 由用户应用程序代码引起的等待(例如:由行级锁定或显式锁定命令引起的锁定等待)。
- Cluster 与集群资源相关的等待(例如:“gc cr block busy” 等全局缓存资源)。
- Commit 此等待类仅包含一个等待事件—提交后等待 Redo 日志写入确认(即“日志文件同步”)。
- Concurrency 等待内部数据库资源(例如:闩锁)。
- Configuration 由于数据库或实例资源配置不足而导致的等待(例如:日志文件大小/共享池大小太小)。
- Idle 表示会话处于非活动状态的等待工作(例如:“来自客户端的 SQL*Net 消息”)。
- Network 与网络消息传递相关的等待(例如:'SQL*Net more data to dblink')。
- Other 系统上通常不应发生的等待(例如:“等待 EMON 生成”)。
- Queueing 表示在流水线环境中获取附加数据的延迟事件。在这些等待事件上花费的时间表明管道中的效率低下或其他问题。它会影响并行查询或 DBMS_PIPE PL/SQL 包等功能。
- Scheduler 与资源管理器相关的等待(例如:'resmgr: become active')。
- System I/O 等待后台进程 I/O(例如:DBWR 等待 'db file parallel write')。
- User I/O 等待用户 I/O(例如:“db 文件顺序读取”)。
查看等待事件
可在系统租户下通过 SQL 语句按字母顺序显示所有等待事件及其所属的等待事件类型。示例如下:
obclient> SELECT name, wait_class FROM V$EVENT_NAME ORDER BY name;
常见等待事件
| 等待事件名称 | 描述 | 等待事件所属类型名称 | 等待事件的参数 1 | 等待事件的参数 2 | 等待事件的参数 3 |
|---|---|---|---|---|---|
| wait remove partition | 分区 GC 等待事务模块删除 | ADMINISTRATIVE | tenant_id | table_id | partition_id |
| wait end stmt | 语句结束等待 | CLUSTER | rollback | trans_hash_value | physic_plan_type |
| wait start stmt | 语句开启等待 | CLUSTER | trans_hash_value | physic_plan_type | participant_count |
| wait end trans | 事务提交等待 | COMMIT | rollback | trans_hash_value | participant_count |
| async rpc proxy condition wait | 上层封装的异步 RPC Wait 事件 | CONCURRENCY | address | - | - |
| dag worker condition wait | 后台 dag 线程等待事件 | CONCURRENCY | address | - | - |
| hashmap lock wait | HASH 表锁等待事件 | CONCURRENCY | address | number | tries |
| latch: alive server tracer lock wait | OBAliveServerMap 操作内存中 OBServer 状态的锁等待 | CONCURRENCY | address | number | tries |
| latch: alloc block lock wait | OceanBase malloc 内部管理 K 级别内存块的锁等待 | CONCURRENCY | address | number | tries |
| latch: alloc object lock wait | OceanBase malloc 内部管理小块内存的锁等待事件 | CONCURRENCY | address | number | tries |
| latch: allocator chunk lock wait | OceanBase malloc 内部管理 2 M 以上内存的锁等待事件 | CONCURRENCY | address | number | tries |
| latch: clog cascading info lock wait | clog 副本级联模块锁的等待事件 | CONCURRENCY | address | number | tries |
| latch: clog locality lock wait | clog 内部保护 Locality 信息的锁 | CONCURRENCY | address | number | tries |
| latch: clog membership mgr lock wait | clog 模块成员变更的锁 | CONCURRENCY | address | number | tries |
| latch: clog reconfirm lock wait | clog 模块 Reconfirm 类使用的锁 | CONCURRENCY | address | number | tries |
| latch: clog stat mgr lock wait | clog 模块状态切换的锁 | CONCURRENCY | address | number | tries |
| latch: clog sw renew ms task lock wait | clog 备库更新成员组信息的锁等待 | CONCURRENCY | address | number | tries |
| latch: clog switch info lock wait | clog 模块保护主备库切换信息的锁 | CONCURRENCY | address | number | tries |
| latch: clog task lock wait | clog 模块 log_task 的锁 | CONCURRENCY | address | number | tries |
| latch: config lock wait | 配置项锁等待事件 | CONCURRENCY | address | number | tries |
| latch: default drw lock wait | DRWLock 等待事件,DRWLock 是一个适应读多写少场景的读写锁 | CONCURRENCY | address | number | tries |
| latch: default mutex wait | 缺省 MUTEX 等待事件 | CONCURRENCY | address | number | tries |
| latch: default recursive mutex wait | 缺省递归 MUTEX 等待事件 | CONCURRENCY | address | number | tries |
| latch: default spin lock wait | 缺省自旋锁等待事件 | CONCURRENCY | address | number | tries |
| latch: default spin rwlock wait | 缺省自旋读写锁等待事件 | CONCURRENCY | address | number | tries |
| latch: id map node lock wait | ID Map 等待事件,ID Map 用于把整数映射为指针 | CONCURRENCY | address | number | tries |
| latch: plan cache pcv set lock wait | Plan Cache 添加新对象时加锁等待耗时 | CONCURRENCY | address | number | tries |
| latch: plan set lock wait | Plan Cache 加锁耗时 | CONCURRENCY | address | number | tries |
| latch: ps store lock wait | PS Cache 加锁耗时 | CONCURRENCY | address | number | tries |
| latch: server maintaince lock wait | RS 进行 OBServer 操作时的锁等待 | CONCURRENCY | address | number | tries |
| latch: server status lock wait | 操作 RS 记录的 server_statuses 时的读写锁等待 | CONCURRENCY | address | number | tries |
| latch: time wheel bucket lock wait | 事务层定时器上 BUCKET 锁 | CONCURRENCY | address | number | tries |
| latch: time wheel task lock wait | 事务定时任务的锁 | CONCURRENCY | address | number | tries |
| latch: trans ctx lock wait | 事务上下文并发操作的互斥锁等待 | CONCURRENCY | address | number | tries |
| latch: unit manager lock wait | Unit Manager 操作数据的锁等待 | CONCURRENCY | address | number | tries |
| latch: zone infos rw lock wait | OBZoneManagerBase 操作数据的锁等待 | CONCURRENCY | address | number | tries |
| latch: zone manager maintaince lock wait | Zone Manager 操作数据的锁等待 | CONCURRENCY | address | number | tries |
| ob dynamic thread pool condition wait | 动态扩展的线程池锁等待事件 | CONCURRENCY | address | - | - |
| partition location cache lock wait | Location Cache 刷新时,防并发刷新等待事件 | CONCURRENCY | table_id | partition_id | - |
| partition table updater condition wait | OBUniqTaskQueue 处理任务时的条件等待 | CONCURRENCY | address | - | - |
| rebalance task mgr condition wait | OBDRTaskMgr 处理容灾任务时的条件等待 | CONCURRENCY | address | - | - |
| reentrant thread condition wait | OBReentrantThread 处理任务时的条件等待 | CONCURRENCY | address | - | - |
| rpc session handler condition wait | 流式 RPC 等待事件 | CONCURRENCY | address | - | - |
| th worker condition wait | 多租户线程挂起等待事件 | CONCURRENCY | address | - | - |
| thread idling condition wait | RootService 空闲线程等待事件 | CONCURRENCY | address | - | - |
| sched idle | 多租户线程等待任务执行 | IDLE | wait start timestamp | - | - |
| mysql response wait client | 等待客户端返回耗时 | NETWORK | - | - | - |
| sync rpc | 同步 RPC 等待事件 | NETWORK | pcode | size | - |
| sched wait | 多租户线程因执行大查询被挂起 | SCHEDULER | req type | req start timestamp | wait start timestamp |
| bloomfilter build read | 后台 BloomFilter 创建数据读取 | SYSTEM_IO | fd | offset | size |
| db file compact read | compaction 任务数据读取 | SYSTEM_IO | fd | offset | size |
| db file compact write | compaction 任务数据写入 | SYSTEM_IO | fd | offset | size |
| db file index build read | 索引创建数据读取 | SYSTEM_IO | fd | offset | size |
| db file index build write | 索引创建数据写入 | SYSTEM_IO | fd | offset | size |
| db file migrate read | 迁移数据读取 | SYSTEM_IO | fd | offset | size |
| db file migrate write | 迁移数据写入 | SYSTEM_IO | fd | offset | size |
| memstore memory page alloc info | MemStore 写入限速触发的计算值 | SYSTEM_IO | cur_mem_hold | sleep_interval | cur_ts |
| memstore memory page alloc wait | MemStore 写入限速触发的等待时间 | SYSTEM_IO | cur_mem_hold | sleep_interval | cur_ts |
| db file data index read | 用户数据微块索引读取 | USER_IO | fd | offset | size |
| db file data read | 用户数据读取 | USER_IO | fd | offset | size |
| interm result disk read | 中间结果数据读取 | USER_IO | fd | offset | size |
| interm result disk write | 中间结果数据写入 | USER_IO | fd | offset | size |
| row store disk read | SQL 算子落盘数据读取 | USER_IO | fd | offset | size |
| row store disk write | SQL 算子落盘数据写入 | USER_IO | fd | offset | size |
| backup info wait | 备份信息管理器内部的等待 | CONCURRENCY | address | number | tries |
| build index scheduler condition wait | DDL 两次任务调度的等待时间 | CONCURRENCY | address | - | - |
| debug sync condition wait | Errsim Debug 模式下有意义,用户场景无意义 | CONCURRENCY | address | - | - |
| inner connection pool condition wait | 内部连接池条件等待 | CONCURRENCY | address | - | - |
| latch: archive restore queue lock wait | 物理恢复日志时控制任务队列 POP 并发的锁 | CONCURRENCY | address | number | tries |
| latch: bandwidth throttle lock wait | 带宽限流的锁等待 | CONCURRENCY | address | number | tries |
| latch: default bucket lock wait | Bucket Lock 的等待时间,未归类 | CONCURRENCY | address | number | tries |
| latch: election group lock wait | 保护 Election Group 信息的锁 | CONCURRENCY | address | number | tries |
| latch: election group trace recorder lock wait | 保护 Election Group Trace 统计信息的锁 | CONCURRENCY | address | number | tries |
| latch: election lock wait | 选主线程的等锁时间 | CONCURRENCY | address | number | tries |
| latch: election msg lock wait | 选举消息的锁等待 | CONCURRENCY | address | number | tries |
| latch: group migrate lock wait | 批量迁移的锁等待 | CONCURRENCY | address | number | tries |
| latch: group migrate task idle wait | 批量迁移的任务空闲锁等待 | CONCURRENCY | address | number | tries |
| latch: group migrate task lock wait | 批量迁移的任务锁等待 | CONCURRENCY | address | number | tries |
| latch: io queue lock wait | I/O queue 读取时的锁等待 | CONCURRENCY | address | number | tries |
| latch: migrate lock wait | 迁移的锁等待 | CONCURRENCY | address | number | tries |
| latch: multi tenant lock wait | 多租户管理的锁等待 | CONCURRENCY | address | number | tries |
| latch: rebuild retry list lock wait | Rebuild 任务的等待 | CONCURRENCY | address | number | tries |
| latch: session trace recorder lock wait | Session 上 Trace 记录的锁等待 | CONCURRENCY | address | number | tries |
| latch: tenant lock wait | 租户内管理的锁等待 | CONCURRENCY | address | number | tries |
| latch: timezone lock wait | 租户的 Timezone 结构锁等待,租户操作的时候会上锁 | CONCURRENCY | address | number | tries |
| latch: trace recorder lock wait | SQL Trace 记录的锁等待; | CONCURRENCY | address | number | tries |
| ob request timeinfo list wait | 请求计数的锁统计,跟 Plan Cache 兜底有关 | CONCURRENCY | address | - | - |
| ob restore reader condition wait | 备份恢复相关的等待信息 | CONCURRENCY | address | - | - |
| oblog part mgr schema version wait | Liboblog 的等待刷新 Schema Verison 的逻辑 | CONCURRENCY | - | - | - |
| slog flush condition wait | Slog 刷盘的等待时间 | CONCURRENCY | address | - | - |
| ObCacheLineSegregatedArrayBase alloc mutex | Cache Line 数组分配锁等待 | USER_IO | fd | offset | size |
| server object pool arena lock wait | 大对象缓存结构的锁等待 | USER_IO | fd | offset | size |