Why does disk I/O slow down a CPU bound task?

Nico Kadel-Garcia nkadel at gmail.com
Tue Mar 31 05:02:44 UTC 2015


On Mon, Mar 30, 2015 at 3:58 PM, Dave Johansen <davejohansen at gmail.com> wrote:
> I noticed on RHEL 6 that when a large amount of disk I/O is happening that
> CPU bound tasks "slow down". I have been able to reproduce it in Fedora 21
> as well and here are the instructions of how I can reproduce it with a
> simple test:

Writing to disk is not "free". There is overhead in writing the data,
especially if the files are being re-arranged and the directory
structure revised, and there's overhead in doing it safely to avoid
accidental loss of data.

There are options to improve such performance, such as using the
'noatime' option, or using well optimized filesystems. But there are
certainly limits.

> 1) Build the disk_test.cc (the "CPU bound task") and run it.
> 2) Create a large file to copy ( fallocate -l 10G junk ).
> 3) Copy that file with a one minute delay between copies ( while true; do cp
> junk junk2; sleep 60; done )
>
> If you direct the output of disk_test.cc to a file, then you can plot the
> results in gnuplot with the following commands to see the change in the mean
> time between "finishing the work cycle" when the file is being copied:
> set xdata time
> set timefmt "%s"
> plot "out.txt" using 1:3 with lines
>
> You can also notice that the load average is also going up, so it seems like
> something in the kernel/scheduler is getting some sort of exclusive lock in
> the disk I/O process and that's causing the CPU bound task to not be able to
> execute when it should. Any ideas?
>
> Thanks,
> Dave
>
> --
> devel mailing list
> devel at lists.fedoraproject.org
> https://admin.fedoraproject.org/mailman/listinfo/devel
> Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct


More information about the devel mailing list