cat /proc/interrupts 验证nvme 中断聚合

最近做了一次实验 用cat /proc/interrupts 抓取nvme的中断次数 ,来验证开启了中断聚合后,中断次数是否会减少

1 首先我们先看下盘的默认值是多少

bash 复制代码
[debian~]#nvme get-feature /dev/nvme9 -f 0x7 -H  #查看支持的最大队列
get-feature:0x7 (Number of Queues), Current value:0x7f007f
        Number of IO Completion Queues Allocated (NCQA): 128
        Number of IO Submission Queues Allocated (NSQA): 128
[debian~]#nvme get-feature /dev/nvme9 -f 0x8 -H  #查看当前的聚合数 0000默认没有打开中断
get-feature:0x8 (Interrupt Coalescing), Current value:00000000
        Aggregation Time     (TIME): 0 usec
        Aggregation Threshold (THR): 1
[debian~]#

2 在没有打开中断的情况下 我们可以跑下FIO 10 分钟,然后抓取30S的前后数据,看看中断增加了多少次,FIO可以用随机读,因为随机读的IOPS最高,中断次数也最高,效果明显

bash 复制代码
fio --name=job111 --filename=/dev/nvme9n1  --ioengine=libaio --direct=1 --thread=1 --numjobs=8 --iodepth=64 --rw=randread  --bs=4k --runtime=600 --time_based=1 --size=100% --norandommap=1 --randrepeat=0 --group_reporting 

3 抓取一下中断

下面这个命令会把所有队列的中断次数打印出来

bash 复制代码
cat /proc/interrupts |grep nvme9 | awk '{sum=0; for(i=2;i<=NF-3;i++) sum+=$i; print sum}'  >irq_before.txt
sleep 30 
cat /proc/interrupts |grep nvme9 | awk '{sum=0; for(i=2;i<=NF-3;i++) sum+=$i; print sum}'  >irq_after.txt

4 如下图所示 最终计算在30s 内 所有的队列增加的中断次数是33706609

5 重复上边的步骤 可以验证下不同IO场景下,设置不同的聚合数,中断增加的次数

我这里设置0x000109和0x001090来做验证

bash 复制代码
[debian~]#nvme set-feature /dev/nvme9 -f 0x8 -v 0x000109
set-feature:08 (Interrupt Coalescing), value:0x000109
[debian~]#nvme get-feature /dev/nvme9 -f 0x8 -H
get-feature:0x8 (Interrupt Coalescing), Current value:0x000109

[debian~]#nvme set-feature /dev/nvme9 -f 0x8 -v 0x001090
set-feature:08 (Interrupt Coalescing), value:0x001090
[debian~]#nvme get-feature /dev/nvme9 -f 0x8 -H
get-feature:0x8 (Interrupt Coalescing), Current value:0x001090
        Aggregation Time     (TIME): 1600 usec
        Aggregation Threshold (THR): 145

6 统计最终的结果如下:

不过有一点就是 你如果想知道哪种聚合数能让nvme 在满配的情况下跑出最大的型能,真的需要我们自己取调试了,设置0x001090 的时候,我看到盘的性能有显著下降

相关推荐
Wang's Blog7 小时前
Java 接入Redis: 服务启动停止与后台运行配置
java·服务器·redis
EasyGBS10 小时前
终结训推割裂!EasyGBS×EasyAIS×DLTM,实现AI算法训推一体闭环落地!
服务器·深度学习·安全
Doris__HE12 小时前
【元脑服务器NF5476G7-NF5476M7技术规格分享】
运维·服务器·网络·数据库·性能优化
爱喝热水的呀哈喽13 小时前
openroad make各个阶段
服务器
Huangjin007_18 小时前
【Linux 系统篇(二十一)】进程(九):进程等待 wait/waitpid、status状态参数
linux·运维·服务器
ao-weilai18 小时前
Linux网络编程:Socket UDP
linux·服务器·网络·c++
曦夜日长19 小时前
Linux系统篇,进程概念(四):内核链表的深度理解、进程优先级的底层理解
linux·运维·服务器·php
Wang's Blog19 小时前
Java 接入Redis: Redis下载与源码编译安装
java·服务器·redis
Ivanqhz19 小时前
矩阵引擎的数据流模式与 BM1684X 架构
java·服务器·网络·深度学习·神经网络
其实防守也摸鱼21 小时前
DeepSeek Harness 开源贡献手记:从入门到合入主线
服务器·数据库·windows·https·ssl