我要评分
获取效率
正确性
完整性
易理解

Optimizing OS Parameters

  • Purpose

    Adjust the system configuration to maximize the hardware performance.

  • Method

    Table 1 lists the optimization items.

Table 1 OS configuration parameters

Parameter

Description

Suggestion

Procedure

scheduler

I/O scheduling algorithm at the kernel block layer

Default value: This value varies based on the kernel version.

Status: Run the following command to check:

cat /sys/block/sdb/queue/scheduler

Suggestion: Set the drive I/O scheduling policy to mq-deadline.

NOTE:

The following uses /dev/sdb as an example. Configure this setting of all data drives on all servers as required.

Run the following command to set the drive I/O scheduling policy to mq-deadline:

1
echo mq-deadline > /sys/class/block/sdb/queue/scheduler
NOTE:

The following uses /dev/sdb as an example. Configure this setting of all data drives on all servers as required.

max_sectors_kb

Maximum request size allowed by the drive

Default value: This value varies according to the HDD model.

Status: Run the following command to check:

cat /sys/block/sdb/queue/max_sectors_kb

Suggestion: Change the value to the maximum request size allowed by the drive.

NOTE:

The following uses /dev/sdb as an example. Configure this setting of all data drives on all servers as required.

Run the following command to set max_sectors_kb to the allowed maximum request size:

1
cat /sys/block/sdb/queue/max_hw_sectors_kb > /sys/block/sdb/queue/max_sectors_kb
NOTE:

The following uses /dev/sdb as an example. Configure this setting of all data drives on all servers as required.

dirty_ratio

Maximum ratio of dirty pages to total memory

Default value: 40

Status: Run the following command to check:

sysctl -a | grep dirty_ratio

Suggestion: 80

NOTE:

If the maximum ratio of dirty pages to the total memory exceeds dirty_ratio, the system does not add dirty pages and the file read and write operations change to the synchronous mode. In the synchronous mode, the block time of the file read and write operations of the application is prolonged, which slows down the system. The default value of this parameter is 40. For write-intensive services, you can increase this parameter to prevent the drive from entering the synchronous write state too early.

Run the following command to set dirty_ratio to 80:

1
sysctl -w vm.dirty_ratio=80
NOTE:

On openEuler 20.03, dirty_ratio is changed to 60 in /etc/profile.d/performance.sh. You are advised to delete the corresponding line from the file to prevent the setting from being overwritten.