nr_requests 和 queue_depth

修改配置值

nr_requests 和 queue_depth 区别

iostat 的avgqu-sz

lsscsi -l 的队列大小

iostat

nr_requests 和 queue_depth

本文主要介绍Linux 操作系统中 nr_requests 和 queue_depth的参数意义和工作原理。以及结合iostat 的avgqu-sz 之间关系分析。

1.nr_requests 和 queue_depth

操作系统中nr_requests参数,可以提高系统的吞吐量,似乎越大越好,但是该请求队列的也不能过大,因为这样会消耗大量的内存空间。该值的调整需要综合多处因素,

比如: 文件系统、sheduler类型、io的特点。

命令: echo xxx > /sys/block//queue/nr_requests,nr_requests的大小设置至少是/sys/block//device/queue_depth的两倍,所以,修改nr_requtests的时候要注意。

[root@node-1 ~]# cat /sys/block/sdj/queue/nr_requests

256

[root@node-1 ~]# cat /sys/block/sdj/device/queue_depth

64

2.修改配置值

$ echo “512” > /sys/block/sda/queue/nr_requests IO调度队列大小

$ echo “512” > /sys/block/sda/device/queue_depth 磁盘队列深度

3.nr_requests 和 queue_depth 区别

nr_requests:请求的IO调度队列大小

queue_depth:请求在磁盘设备上的队列深度

I/O调度器中的最大I/O操作数是nr_requests * 2。读和写是分开的。

已经分配到底层设备的I/O操作是queue_depth。

一个磁盘设备的I/O操作的最大未完成限制为(nr_requests * 2)+(queue_depth) 。对应iostat 的avgqu-sz。

英文解释

nr_requests

Specifies the maximum number of read and write requests that can be queued at one time.

The default value is 128, which means that 128 read requests and 128 write requests can be queued before the next process to request a read or write is put to sleep.

For latency-sensitive applications, lower the value of this parameter and limit the command queue depth on the storage so that write-back I/O cannot fill the device queue with write requests.

When the device queue fills, other processes attempting to perform I/O operations are put to sleep until queue space becomes available.

Requests are then allocated in a round-robin manner, which prevents one process from continuously consuming all spots in the queue.

The maximum number of I/O operations within the I/O scheduler is nr_requests*2.

As stated, nr_requests is applied separately for reads and writes.

Note that nr_requests only applies to the I/O operations within the I/O scheduler and not to I/O operations already dispatched to the underlying device.

Therefore, the maximum outstanding limit of I/O operations against a device is (nr_requests*2)+(queue_depth) where queue_depth is /sys/block/sdN/device/queue_depth, sometimes also referred to as the LUN queue depth.

You can see this total outstanding number of I/O operations in, for example, the output of iostat in the avgqu-sz column.

指定一次可以排队的读请求和写请求的最大数目。

默认值是128,这意味着128个读请求和128个写请求可以在请求读或写的下一个进程进入睡眠状态之前排队。

对于对延迟敏感的应用程序,可以降低该参数的值,并限制存储上的命令队列深度,以防止回写I/O用写请求填满设备队列。

当设备队列满时,其他试图执行I/O操作的进程将进入休眠状态,直到队列空间可用。

然后以循环的方式分配请求,这可以防止一个进程持续地消耗队列中的所有位置。

I/O调度器中的最大I/O操作数是nr_requests*2。

如前所述,对于读和写,分别应用nr_requests。

注意,nr_requests仅适用于I/O调度器中的I/O操作,而不适用已经分配到底层设备的I/O操作。

因此,对一个设备的I/O操作的最大未完成限制为(nr_requests*2)+(queue_depth),其中queue_depth为/sys/block/sdN/device/queue_depth,有时也称为LUN队列深度。

例如,您可以在avgqu-sz列中的iostat输出中看到这个未完成的I/O操作总数。

4.iostat 的avgqu-sz

该值大小为:(nr_requests*2)+(queue_depth)

5.lsscsi -l 的队列大小

Lun queue depth值来自 /sys/block/sdj/device/queue_depth

[root@node-1 ~]# echo "128" >/sys/block/sdj/device/queue_depth

[root@node-1 ~]# lsscsi -l | grep -A 1 sdj

[0:0:16:0] disk SEAGATE ST1000NX0453 NS02 /dev/sdj

state=running queue_depth=128 scsi_level=7 type=0 device_blocked=0 timeout=90

[root@node-1 ~]# echo "256" >/sys/block/sdj/device/queue_depth

[root@node-1 ~]# lsscsi -l | grep -A 1 sdj

[0:0:16:0] disk SEAGATE ST1000NX0453 NS02 /dev/sdj

state=running queue_depth=256 scsi_level=7 type=0 device_blocked=0 timeout=90

6.iostat

The default value is 1 (enabled).

Setting iostats to 0 disables the gathering of I/O statistics for the device, which removes a small amount of overhead with the I/O path.

Setting iostats to 0 might slightly improve performance for very high performance devices, such as certain NVMe solid-state storage devices.

It is recommended to leave iostats enabled unless otherwise specified for the given storage model by the vendor.

If you disable iostats, the I/O statistics for the device are no longer present within the /proc/diskstats file.

The content of /sys/diskstats is the source of I/O information for monitoring I/O tools, such as sar or iostats.

Therefore, if you disable the iostats parameter for a device, the device is no longer present in the output of I/O monitoring tools.

缺省值为1(启用)。

将iostats设置为0将禁用收集设备的I/O统计信息,这将减少I/O路径的少量开销。

将iostats设置为0可能会略微提高非常高性能设备的性能,比如某些NVMe固态存储设备。

除非供应商为给定的存储模型特别指定,否则建议保持启用iostats。

如果禁用iostats,设备的I/O统计信息将不再存在于/proc/diskstats文件中。

/sys/diskstats的内容是用于监视I/O工具(如sar或iostats)的I/O信息的来源。

因此,如果对某个设备禁用iostats参数,该设备将不再出现在I/O监控工具的输出中。

linux 网卡队列深度,linux 磁盘队列深度nr_requests 和 queue_depth相关推荐

  1. linux 网卡的驱动程序,Linux网卡驱动程序代码

    广告 100%的CPU性能,计算能力不会降低!选择最主流的云服务器来满足各种业务需求,有数百种流行的云产品和8888元起价套餐,可帮助行业恢复工作! 获取网卡信息的代码示例. 通过命令获取arp(地址 ...

  2. linux网卡顺序问题,linux网卡绑定及网卡顺序变更测试.docx

    Linux网卡顺序变更导致网卡绑定出错及解决办法测试 2012/2/21 描述:linux中新安装网卡会导致原网卡识别顺序紊乱,影响网络及网卡绑定正常工作,此时可以更改/etc/sysconfig/n ...

  3. linux网卡汇聚模式,Linux网卡聚合 linux多网卡绑定聚合之bond模式原理

    Linux网卡聚合 linux多网卡绑定聚合之bond模式原理 发布时间:2014-10-14 09:44:35   作者:佚名   我要评论 将多个Linux网络端口绑定为一个,可以提升网络的性能, ...

  4. linux网卡 命令 ncmil,Linux常用性能检测命令解释

    1.uptime [root@smgsim02 ~]# uptime 15:08:15 up 98 days, 4:19, 2 users, load average: 0.07, 0.29, 0.1 ...

  5. linux 网卡 mac 配置文件,Linux下更改网卡的MAC物理地址

    有些地方是把网络地址和网卡物理地址绑定的,当换了网卡或其它电脑时可能会上不了网,下面介绍更改物理地址(MAC Address)的方法.分为临时更改和长期更改两种情况,两种方法均不实际改变网卡的真实属性 ...

  6. linux 网卡物理地址修改,Linux修改 网卡物理地址(Mac Address)

    有些地点 是把网络地址和网卡物理地址绑定的,当换了网卡或其它计算机 时可能会上不了网,下面介绍修改 物理地址(MAC Address)的要领 .分为临时修改 和长期修改 两种情况,两种要领 均不实际改 ...

  7. linux网卡名字 mac,linux下编程如何获得所有网卡的信息-包括网卡名字,网卡MAC等等......

    linux下编程如何获得所有网卡的信息-包括网卡名字,网卡MAC等等... (2012-06-07 04:35:41) 标签: 的 linux 数据包 杂谈 linux下编程如何获得所有网卡的信息?包 ...

  8. linux网卡不能上网,linux无法联网

    linux无法联网 linux无法联网的解决方法如下: 一.查看网卡配置 查看网卡设置,linux下网卡的配置文件在 /etc/sysconfig/network-scripts/ 使用ls查看然后用 ...

  9. Linux网卡模块,裁剪Linux并实现网卡模块的安装(附有命令移植的脚本)

    Linux的设计模式:核心和外围功能性模块组构成的,其内核支持动态模块的装载和卸载. 裁剪Liniux的原理: -->POST(Power-on Self Test:开机自检) -->BI ...

  10. linux 网卡配置目录,Linux目录结构以及网卡配置

    一.Linux下的目录结构 /bin 存放二进制命令 /boot系统引导程序 /dev设备,硬盘 /etc系统应用的配置文件 /home普通用户家目录 /lib库文件 /lib64 64位的库文件 / ...

最新文章

  1. 将新更新从原始GitHub存储库中提取到派生的GitHub存储库中
  2. linux终端出现bash: setup.bash: No such file or directory,和.bashrc文件的问题
  3. HTML 5 视频/音频参考手册
  4. c++ 如何获取网络时间_云台山茶旅集团如何四年时间获取十万老人的万千目光...
  5. powerdesigner连接db2生成模型步骤
  6. SQL如何备份到异机
  7. 在Spring Boot中使用@ConfigurationProperties
  8. 十、input与跳转
  9. Linux 脚本、 正则表达式 等
  10. php ob 缓存,php中ob函数缓冲机制深入理解
  11. Hadoop入门基础教程 Hadoop之伪分布式环境搭建
  12. 互联网大佬为什么爱唱歌?
  13. Excel如何将xlsx后缀格式的文件转为xls格式?
  14. Java开发从零开始!java游戏服务器开发教程
  15. php一元二次方程求根,JavaScript_在线一元二次方程计算器实例(方程计算器在线计算),复制代码 代码如下:htmll - phpStudy...
  16. C# WPF 获取系统文化和国家信息(CultureInfo)类
  17. Day13 多态、Object、抽象、接口
  18. ShowDoc的使用
  19. Spring Boot + 微信公众号授权登录获取用户信息
  20. Microsoft Office 2016安装

热门文章

  1. Word一行有空白格,却无法输入新的文字
  2. 计算机快速格式化u盘启动,制作启动盘格式化u盘
  3. SAP HANA SDA实战
  4. 2021毓英中学高考成绩查询,泉州知名中学2020高考成绩喜报龙虎榜
  5. java整数相乘得负数_关于java:将2(小)个数字相乘得到负数的解决方案,而不是溢出…为什么?...
  6. uni-app Image组件在加载图片发生错误时,显示默认图片
  7. 解决win10邮箱无法登陆163企业邮箱的问题
  8. java中判断一个单词是否以a开头_查找Java中所有以'a'开头的单词
  9. kafka最全面试题汇总
  10. Intel E100 网卡驱动实例分析