Got it

Checking the Disk Access Mode in Linux

204 0 1 0 0

If a standard performance test is conducted in a Linux environment, it is recommended that you set the disk access mode to Direct I/O.

Linux has a kernel buffer. The buffered I/O mechanism stores I/O data to the page cache. That is, data is first copied to the buffer of the Linux kernel and then to the address space of the application program. Comparatively, the Direct I/O mechanism enables data to be directly transmitted between the buffer of the user address space and disks without the need to use the page cache.

If you use the Vdbench tool or the dd command to test performance without specifying Direct I/O, Buffered I/O is used by default. The default page cache size employed by Linux is 4 KB. If an I/O is larger than 4 KB, the following issues occur:

l   In the kernel buffer, the host splits the I/O. On the block device layer, small I/Os are combined. As a result, the high CPU overheads are required.

l   In a high-concurrency scenario, small I/Os may not be combined into large I/Os on the block device layer before being written to disks. As a result, the I/O model is changed, and disks may not be able to provide the maximum bandwidth performance.

Set the disk access mode to Direct I/O as follows:

l   When Vdbench is used, set openflags to o_direct in sd.

sd=default,openflags=o_direct,threads=32

l   When the dd command is used:

           Set oflag to direct to test the write performance.

dd if=/dev/zero of=/testw.dbf bs=4k oflag=direct count=100000

           Set iflag to direct to test the read performance.

dd if=/dev/sdb of=/dev/null bs=4k iflag=direct count=100000


Comment

You need to log in to comment to the post Login | Register
Comment

Notice: To protect the legitimate rights and interests of you, the community, and third parties, do not release content that may bring legal risks to all parties, including but are not limited to the following:
  • Politically sensitive content
  • Content concerning pornography, gambling, and drug abuse
  • Content that may disclose or infringe upon others ' commercial secrets, intellectual properties, including trade marks, copyrights, and patents, and personal privacy
Do not share your account and password with others. All operations performed using your account will be regarded as your own actions and all consequences arising therefrom will be borne by you. For details, see " User Agreement."

My Followers

Login and enjoy all the member benefits

Login

Block
Are you sure to block this user?
Users on your blacklist cannot comment on your post,cannot mention you, cannot send you private messages.
Reminder
Please bind your phone number to obtain invitation bonus.