Generic block device tuning parameters
The generic tuning parameters listed here are available in the /sys/block/sdX/queue/ directory.
The following listed tuning parameters are separate from I/O scheduler tuning, and are applicable to all I/O schedulers:
-
add_random - Some I/O events contribute to the entropy pool for the
/dev/random. This parameter can be set to0if the overhead of these contributions become measurable. -
iostats -
By default,
iostatsis enabled and the default value is1. Settingiostatsto0disables gathering of I/O statistics for the device. This removes a small amount of overhead with the I/O path.Setting
iostatsto0might improve performance for high performance devices, such as certain Non-volatile Memory Express (NVMe) storage devices. It is preferable to leaveiostatsenabled 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/diskstatsfile. The content of/sys/diskstatsfile is the source of I/O information for monitoring I/O tools, such assaroriostats. Therefore, if you disable theiostatsparameter for a device, it is no longer present in the output of I/O monitoring tools. -
max_sectors_kb -
Specifies the maximum size of an I/O request in kilobytes. The default value is
512KB. The minimum value for this parameter is determined by the logical block size of the storage device. The maximum value for this parameter is determined by the value of themax_hw_sectors_kb.max_sectors_kbmust always be a multiple of the optimal I/O size and the internal erase block size. Use a value oflogical_block_sizefor either parameter if they are zero or not specified by the storage device. -
nomerges - Most workloads benefit from request merging. However, disabling merges can be useful for debugging purposes. By default, the
nomergesparameter is set to0, which enables merging. To disable simple one-hit merging, setnomergesto1. and to disable all types of merging, setnomergesto2. -
nr_requests - It is the maximum allowed number of the queued I/O. If the current I/O scheduler is
none, this number can only be reduced; otherwise the number can be increased or reduced. -
optimal_io_size - Some storage devices report an optimal I/O size through this parameter. If this value is reported, applications issue I/O aligned to and in multiples of the optimal I/O size wherever possible.
-
read_ahead_kb -
Defines the maximum number of kilobytes that the operating system may read ahead during a sequential read operation. As a result, the necessary information is already present within the kernel page cache for the next sequential read. This improves read I/O performance.
Device mappers often benefit from a high
read_ahead_kbvalue.128KB for each device to be mapped is a good starting point. Increasing theread_ahead_kbvalue up to request queue’smax_sectors_kbof the disk might improve performance where sequential reading of large files occur. -
rotational - Some solid-state disks do not correctly advertise their solid-state status, and are mounted as traditional rotational disks. Manually set the
rotationalvalue to0to disable unnecessary seek-reducing logic in the scheduler. -
rq_affinity - The default value of the
rq_affinityis1. It completes the I/O operations on one CPU core, which is in the same CPU group of the issued CPU core. To perform completions only on the processor that issued the I/O request, set therq_affinityto2. To disable the mentioned two abilities, set it to0. -
scheduler - To set the scheduler or scheduler preference order for a storage device, edit the
/sys/block/devname/queue/scheduler. Replace devname with the device name you want to configure.