https://support.huawei.com/enterprise/en/doc/EDOC1000181485/ddbc0e8b/optimizing-block-device-parameter-settings-of-linux#:~:text=The%20queue%20depth%20determines%20the%20maximum%20number%20of,block%20device%2C%20run%20cat.%20linux-ob3a%3A~%20%23%20cat%20%2Fsys%2Fblock%2Fsdc%2Fqueue%2Fnr_requests

Operating block devices will greatly affect host performance. Correct configuration of the queue depth scheduling algorithm, prefetch volume, and I/O alignment for block devices helps improve the system performance.

Queue Depth

The queue depth determines the maximum number of concurrent I/Os written to the block device. In Linux, the default value is 128. Do not change the value unless absolutely necessary. To query the queue depth of the block device, run cat.

linux-ob3a:~ # cat /sys/block/sdc/queue/nr_requests 
128

In the event of testing the highest system performance, you can set the queue depth to a larger value to increase the I/O write pressure and the probability of combining I/Os in the queue. To temporarily change the queue depth of a block device, use the following method:

echo 256 > /sys/block/sdc/queue/nr_requests

You can tune the performance by temporarily changing the queue depth of a block device. After the application server is restarted, the queue depth is restored to the default value.

Scheduling Algorithm

Linux 2.6 kernel supports four types of block device scheduling algorithms: noop, anticipatory, deadline, and cfq. The default scheduling algorithm is cfq. To query the block device scheduling algorithm in use, run cat.

linux-ob3a:~ # cat /sys/block/sdc/queue/scheduler 
noop deadline [cfq] 

Inappropriate configuration of the scheduling algorithm affects system performance, such as I/O concurrency. You can use the following method to temporarily change the scheduling algorithm of the block device:

echo noop > /sys/block/sdc/queue/scheduler

You can tune the performance by temporarily changing the scheduling algorithm. After the application server is restarted, the scheduling algorithm is restored to the default value.

Prefetch Volume

Similar to the prefetch algorithm of a storage array, the prefetch function of Linux is only available for sequential read, sequential streams identification, and reading of data in the read_ahead_kb length (in units of sectors) in advance. For example, the default prefetch volume in SUSE 11 is 512 sectors, namely, 256 KB. To query the prefetch volume of the block device, run cat.

linux-ob3a:~ # cat /sys/block/sdc/queue/read_ahead_kb 
512

If an application needs to read a large number of large-sized files, you can raise the system performance by setting the prefetch volume to a larger value. To do this, use the following method:

echo 1024 > /sys/block/sdc/queue/read_ahead_kb

I/O Alignment

If MBR partitions are created in Linux or Windows (pre Windows Server 2003 versions), the first 63 sectors of a disk are reserved for the master boot record and partition table. The first partition starts from the 64th sector by default. As a result, misalignment occurs between data blocks (database or file system) delivered by hosts and data blocks stored in the storage array, causing poor I/O processing efficiency.

In Linux, you can resolve I/O misalignment in either of the following ways:

  • Method 1: Change the start location of a partition.

    When creating MBR partitions in Linux, it is recommended that you enter the expert mode of the fdisk command and set the start location of the first partition to that of the second extent on a LUN. The default extent size is 4 MB. The following is a quick command used to create an MBR partition in /dev/sdb. The partition uses all space of /dev/sdb. The start sector is set to 8192, namely, 4 MB.

    printf "n\np\n1\n\n\nx\nb\n1\n 8192\nw\n" | fdisk /dev/sdb
  • Method 2: Create GPT partitions.

    The following is a quick command used to create a GPT partition in /dev/sdb. The partition uses all space of /dev/sdb. The start sector is set to 8192, namely, 4 MB.

    parted -s -- /dev/sdb "mklabel gpt" "unit s" "mkpart primary 8192 -1" "print"

To create MBR partitions in Windows (pre Windows Server 2003 versions), it is recommended that you run diskpart to set partition alignment.

diskpart> select disk 1 
diskpart> create partition primary align=4096

[转帖]Optimizing Block Device Parameter Settings of Linux的更多相关文章

  1. 部署samba服务之后,在客户端用挂载访问的方式,错误信息:mount: block device //192.168.1.108/mysqldata is write-protected, mounting read-only mount: cannot mount block device //192.168.1.108/mysqldata read-only

    部署samba服务之后,在客户端用挂载访问的方式,错误信息:mount: block device //192.168.1.108/mysqldata is write-protected, moun ...

  2. Is an MTD device a block device or a char device?

    转:http://www.linux-mtd.infradead.org/faq/general.html#L_mtd_what Note, you can find Ukranian transla ...

  3. RMAN备份失败之:mount: block device /dev/emcpowerc1 is write-protected, mounting read-only

    今天再做巡检的时候发现有一台服务器的RMAN备份不正常,有一段时间没能正常备份了.检查了一下脚本,正常,定时任务列表也正常,再检查一下/var/log/cron的内容,也没有问题.尝试在该挂载点上创建 ...

  4. centos6.4 ceph安装部署之ceph block device

    1,prelight/preface ceph storage clusterceph block deviceceph filesystemceph object storage 此篇记录ceph ...

  5. Openstack: aborted: Block Device Mapping is Invalid

    Issue: When you create an instance, you may encounter following exception: aborted: Block Device Map ...

  6. QEMU KVM Libvirt手册(6) – Network Block Device

    网络块设备是通过NBD Server将虚拟块设备通过TCP/IP export出来,可以远程访问. NBD Server通常是qemu-nbd 可以提供unix socket qemu-nbd -t ...

  7. Mount 挂载错误mount:block device /dev/sr0 is write – protected , mounting read-only

    Mount 挂载错误mount:block device /dev/sr0 is write – protected , mounting read-only 安装虚拟机出现以下提示: mount:b ...

  8. mount: block device /dev/cdrom is write-protected, mounting read-only 解决方法

    [root@localhost ~]# mount /dev/cdrom /mnt/cdrom/ mount: block device /dev/sr0 is write-protected, mo ...

  9. DRBD(Distributed Replicated Block Device) 分布式块设备复制 进行集群高可用方案

    DRBD是一个用软件实现的.无共享的.服务器之间镜像块设备内容的存储复制解决方案. 外文名 DRBD drbdadm 高级管理工具 drbdsetup 置装载进kernel的DRBD模块 drbdme ...

  10. Nova: 虚机的块设备总结 [Nova Instance Block Device]

    和物理机一样,虚拟机包括几个重要的部分:CPU.内存.磁盘设备.网络设备等.本文将简要总结虚机磁盘设备有关知识. 1. Nova boot CLI 中有关虚机块设备的几个参数 nova boot CL ...

随机推荐

  1. 文心一言 VS chatgpt (17)-- 算法导论4.1 3~4题

    三.在你的计算机上实现最大子数组问题的暴力算法和递归算法.请指出多大的问题规模n0是性能交叉点一一从此之后递归算法将击败暴力算法?然后,修改递归算法的基本情况一一当问题规模小于 n0 时采用暴力算法. ...

  2. 【乘风破浪的开发者】丁一超:从AI实战营出发探索未知的AI世界

    摘要:从年初的不知不觉进入AI学习的道路,到认识并熟练使用ModelArts平台.虽然只有短短的半年,但这半年的探索学习,让丁一超看清了未来的路在何方. 从招聘网站上输入"人工智能工程技术人 ...

  3. 从标准到开发,解读基于MOF的应用模型管理

    摘要:为了打破技术与业务的壁垒,搭建技术与业务的桥梁,因此基于如下流程实现应用业务模型管理 ROMA ABM. 在数字经济时代,数据正在成为企业极其重要的战略性资产.在政府方面,数据第一次作为新型生产 ...

  4. 网络知识一箩筐:IP地址划分的那些知识点

    摘要:IP地址是怎么划分的呢?划分的依据是什么呢?本节小课将带你一起学习IP地址划分.子网划分.子网掩码.CIDR等网络基础概念,了解IP地址划分背后的那些故事. 首先,回忆一下,前面小课中我们有提到 ...

  5. 云数据库 GaussDB(for Influx) 解密第十一期:让智能电网中时序数据处理更高效

    摘要:GaussDB(for Influx)是一款基于计算存储分离架构,完全兼容 InfluxDB 生态的云原生时序数据库. 本文分享自华为云社区<云数据库 GaussDB(for Influx ...

  6. centos8 新增ssh自定义端口与屏蔽默认22端口。

    第一步:修改SSH配置文件(注意是sshd_config而不是ssh_config,多了个d) vim /etc/ssh/sshd_config找到"#Port 22",这一行直接 ...

  7. 抓包工具 Fiddler 抓取 exe 包

    浏览器访问网页,可以使用 Fiddler 直接抓去,如果是 exe的客户端,可以借助 Proxifier 工具 设置完成后,添加代理规则,排除fiddler,也就是让fiddler进行网络直连.不然f ...

  8. Flask中本地代理的使用

    本地代理 当请求到来时应用上下文和程序上下文被推入本地栈中,全局变量current_app,request,g,session都可以使用了.以current_app为例,current_app代表的是 ...

  9. 【计算机网络】JWT token、Session

    JWT token https://www.bilibili.com/video/BV1VM4y117qr/?spm_id_from=333.999.0.0&vd_source=d112766 ...

  10. 【JAVA基础】String处理

    String处理 字符串查找子串及截取 // 保存的头像文件的文件名 String suffix = ""; String originalFilename = file.getO ...