searchusermenu
  • 发布文章
  • 消息中心
点赞
收藏
评论
分享
原创

blktrace使用简介

2023-09-12 06:59:25
38
0

1. 输出说明

Event:
A : remap 对于栈式设备,进来的 I/O 将被重新映射到 I/O 栈中的具体设备。
X : split 对于做了 Raid 或进行了 device mapper(dm) 的设备,进来的 I/O 可能需要切割,然后发送给不同的设备。
Q : queued I/O 进入 block layer,将要被 request 代码处理(即将生成 I/O 请求)。
G : get request I/O 请求(request)生成,为 I/O 分配一个 request 结构体。
M : back merge 之前已经存在的 I/O request 的终止 block 号,和该 I/O 的起始 block 号一致,就会合并,也就是向后合并。
F : front merge 之前已经存在的 I/O request 的起始 block 号,和该 I/O 的终止 block 号一致,就会合并,也就是向前合并。
I : inserted I/O 请求被插入到 I/O scheduler 队列。
S : sleep 没有可用的 request 结构体,也就是 I/O 满了,只能等待有 request 结构体完成释放。
P : plug 当一个 I/O 入队一个空队列时,Linux 会锁住这个队列,不处理该 I/O,这样做是为了等待一会,看有没有新的 I/O 进来,可以合并。
U : unplug 当队列中已经有 I/O request 时,会放开这个队列,准备向磁盘驱动发送该 I/O。这个动作的触发条件是:超时(plug 的时候,会设置超时时间);或者是有一些 I/O 在队列中(多于 1 个 I/O)。
D : issued I/O 将会被传送给磁盘驱动程序处理。
C : complete I/O 处理被磁盘处理完成。
 
action:
不同时间计算如下:
 Q------->G------------>I--------->M------------------->D----------------------------->C
 |-Q time-|-Insert time-|
 |--------- merge time ------------|-merge with other IO|
 |----------------scheduler time --------------------------|---driver,adapter,storagetime--|
 
 |----------------------- await time in iostat output ----------------------------------|
 
其中:
  • Q2Q — time between requests sent to the block layer
  • Q2G — time from a block I/O is queued to the time it gets a request allocated for it
  • G2I — time from a request is allocated to the time it is Inserted into the device's queue
  • Q2M — time from a block I/O is queued to the time it gets merged with an existing request
  • I2D — time from a request is inserted into the device's queue to the time it is actually issued to the device
  • M2D — time from a block I/O is merged with an exiting request until the request is issued to the device
  • D2C — service time of the request by the device
  • Q2C — total time spent in the block layer for a request

2. 使用说明

实时查看命令如下:
 
# blktrace -d /dev/sda -o - | blkparse -i -
 
先收集再查看命令如下:
# 1. 生成采集文件 blktrace -d /dev/sdx -w 10 (times)
# 2. 合并二进制文件并输出到文件 blkparse -i sdb -d sdb.blktrace.bin -o back.txt
# 3. 生成统计信息 btt -i sdb.blktrace.bin -l sda.d2c_latency
 
0条评论
0 / 1000
一颗苹果
4文章数
1粉丝数
一颗苹果
4 文章 | 1 粉丝
一颗苹果
4文章数
1粉丝数
一颗苹果
4 文章 | 1 粉丝
原创

blktrace使用简介

2023-09-12 06:59:25
38
0

1. 输出说明

Event:
A : remap 对于栈式设备,进来的 I/O 将被重新映射到 I/O 栈中的具体设备。
X : split 对于做了 Raid 或进行了 device mapper(dm) 的设备,进来的 I/O 可能需要切割,然后发送给不同的设备。
Q : queued I/O 进入 block layer,将要被 request 代码处理(即将生成 I/O 请求)。
G : get request I/O 请求(request)生成,为 I/O 分配一个 request 结构体。
M : back merge 之前已经存在的 I/O request 的终止 block 号,和该 I/O 的起始 block 号一致,就会合并,也就是向后合并。
F : front merge 之前已经存在的 I/O request 的起始 block 号,和该 I/O 的终止 block 号一致,就会合并,也就是向前合并。
I : inserted I/O 请求被插入到 I/O scheduler 队列。
S : sleep 没有可用的 request 结构体,也就是 I/O 满了,只能等待有 request 结构体完成释放。
P : plug 当一个 I/O 入队一个空队列时,Linux 会锁住这个队列,不处理该 I/O,这样做是为了等待一会,看有没有新的 I/O 进来,可以合并。
U : unplug 当队列中已经有 I/O request 时,会放开这个队列,准备向磁盘驱动发送该 I/O。这个动作的触发条件是:超时(plug 的时候,会设置超时时间);或者是有一些 I/O 在队列中(多于 1 个 I/O)。
D : issued I/O 将会被传送给磁盘驱动程序处理。
C : complete I/O 处理被磁盘处理完成。
 
action:
不同时间计算如下:
 Q------->G------------>I--------->M------------------->D----------------------------->C
 |-Q time-|-Insert time-|
 |--------- merge time ------------|-merge with other IO|
 |----------------scheduler time --------------------------|---driver,adapter,storagetime--|
 
 |----------------------- await time in iostat output ----------------------------------|
 
其中:
  • Q2Q — time between requests sent to the block layer
  • Q2G — time from a block I/O is queued to the time it gets a request allocated for it
  • G2I — time from a request is allocated to the time it is Inserted into the device's queue
  • Q2M — time from a block I/O is queued to the time it gets merged with an existing request
  • I2D — time from a request is inserted into the device's queue to the time it is actually issued to the device
  • M2D — time from a block I/O is merged with an exiting request until the request is issued to the device
  • D2C — service time of the request by the device
  • Q2C — total time spent in the block layer for a request

2. 使用说明

实时查看命令如下:
 
# blktrace -d /dev/sda -o - | blkparse -i -
 
先收集再查看命令如下:
# 1. 生成采集文件 blktrace -d /dev/sdx -w 10 (times)
# 2. 合并二进制文件并输出到文件 blkparse -i sdb -d sdb.blktrace.bin -o back.txt
# 3. 生成统计信息 btt -i sdb.blktrace.bin -l sda.d2c_latency
 
文章来自个人专栏
CTyunos
4 文章 | 1 订阅
0条评论
0 / 1000
请输入你的评论
1
0