# IO scheduler and busy system when HDD is busy

## Ginta

I don't know if it is scheduler's fault, or maybe I miss something, but I realized that when having HDD very busy, the rest of the system is highly unstable and busy too.

I understand that programs will take more to load because of HDD access time reduced, but this is other scenario:

Unpack a 7 GB rar file and try to do other stuff while unpacking.

In my case I opened netbeans and waited for it to be loaded. The problem is even typing is rather slow, and the same for closing opened windows, minimizing apps, and so on.

Is it normal to have this kind of performance hit even on a CORE2 with 4GB ram?

I mean, this impact is so extreme than it should be (for example compairing to other OSes).

Is there any way to reduce this performance impact?

----------

## RazielFMX

It would be easier to see what your IO scheduler is set to and what some of your interrupt settings are in the kernel.  However, that being said, as a general answer, yes, heavy HDD access will kill system performance.  You end up with CPU being wasted in IO Wait.

Do you have dstat installed?  If you do, open a terminal, kick off dstat.

```

----total-cpu-usage---- -dsk/total- -net/total- ---paging-- ---system--

usr sys idl wai hiq siq| read  writ| recv  send|  in   out | int   csw 

  1   0  99   0   0   0|  10k   32k|   0     0 |  10B   13B|  99   158 

  0   0 100   0   0   0|   0     0 | 366B  234B|   0     0 |  93   146 

  0   0 100   0   0   0|   0     0 |  64B    0 |   0     0 | 105   169 

  0   0 100   0   0   0|   0    56k| 398B  312B|   0     0 | 107   226 

  0   1  99   0   0   0|   0     0 |2444B 2270B|   0     0 | 152   768 

  0   0 100   0   0   0|   0     0 | 938B  702B|   0     0 | 118   374

```

Notice the wai column under CPU usage.  Now do your test.  Do you see idl drop to near 0 and wai get really high?  If so, your processes are blocking on disk IO.

----------

## PaulBredbury

 *Ginta wrote:*   

> Unpack a 7 GB rar file and try to do other stuff while unpacking.

 

This is what "ionice" is for. Just give your I/O and CPU schedulers the appropriate hints.

Example:

ionice -c3 schedtool -D -e bzip2 -kfv yourfiletobackup

And of course the BFS is better, for desktop users.

----------

## bollucks

Do note that ionice only affects disk READS. Most stalls occur these days due to disk WRITES. The best way to fix the slowdown currently, is to sacrifice some of the write speed in preference for a more usable system. Dropping the dirty ratio (as per the -ck patchset) will have that effect

echo 1 > /proc/sys/vm/dirty_ratio

slows down writes but does wonders to the system's usability when you're writing large files.

The ionice and scheduler hints as above will do wonders for the read side, and this will help the write side.

----------

## PaulBredbury

Yeah, also commit=

----------

