I'm want to mix CPU and IO intensive benchmarks on the same machine with different levels of CPU utilization and IO throughput.

Unfortunately I couldn't produce an high IO load without stressing the CPU. I tried an ad-hoc program written in C, then rsync with the bandwidth parameter. In theory, it's possible to transfer data from the memory to the disk without CPU intervention, that's what DMA is about.

I would to like to know if there is any API or program which can help me produce a certain IO throughout without producing (too much) CPU load.

  • Do you want to produce high disk IO or any IO, i.e. over the network interface etc? – ajeh Apr 26 '18 at 14:38

You should look at system call sendfile(2) which optimises copying data from one open file descriptor to another within the kernel. Note, the 2 file descriptors do not both have to be disk files. You can also use a network socket.

Also look at flag O_DIRECT when used with open(2) on a file. It allows read/write without a recopy of the data from the dma buffer into the user buffer, but you must align your buffer on a page or similar and use multiples of page sizes for the length.

hdparm -t --direct can do timing tests with this flag.

Some commands from the sg3_utils package, like sg_dd, do low-level disk io, and have options for O_DIRECT too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.