[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Reducing HDD writing affect on whole system.

On Sat, 15 Oct 2011, Camaleón wrote:
> On Sat, 15 Oct 2011 12:39:05 +0700, Sthu Deus wrote:
> > I have terrible delays/freezes w/ any application whenever HDD (a SATA
> > one) does its writing.
> That should not happen at all.

But it does.  The kernel default IO scheduler (CFQ) has serious issues
with "writeback" traffic (dirty memory that needs to get flushed to
disk, be them filesystem buffers/metadata or mmap'd pages, etc).  It is
often not that bad, but it can certainly stall things a great deal with,
e.g. ext4+lvm+md combinations (there are others).

Also, any fsync operation can be *very* expensive if there are too many
outstanding writes on that filesystem.

> Consider running a smartctl test on the disk, it can be dying or having a 
> severe hardware problem.

Well, *any* issue with the disk subsystem will cause such problems to
get several orders of magnitude worse, so yes, one must *first* make
sure the disks are operating at the expected speed.

> > My question is, Whether I can make any adjustments as to FS mount
> > options, kernel parameters, etc?
> > 
> > The idea is, If it works extremely slow - to reduce its (the writing
> > process or whatever related to it) priority or whatever - so it affect
> > not the OS almost at all - though the writing will continue forever.
> I think you should first find out what makes this (freezes and slowness) 
> happens because if you're facing a hardware related issue, there will be 
> no improvements in tweaking the filesystem mount options, sooner or later 
> your disk will fail and you will only delay its agony.

After you are sure the hardware is operating at its proper speed, you
can start tunning the kernel and IO tasks.   There is indeed such a
thing as an IO priority per process, but due to CFQ/writeback issues,
tuning that might not be enough.  You also have to tune the kernel to
not leave too many outstanding pages.   And some filesystems are better
than others for certain workloads.

ionice from util-linux can set the process IO priority.  There are other
utilites that can also do that.

I couldn't readly find any up-to-date (well, up-to-2.6.32) guide on how
to tune the VM subsystem (which controls the writeback) to refer you to,
please look for documentation on how to mess with the /proc/sys/vm/*

And there is always the possibility that you have to actually tune the
applications.  Even if the filesystem, VM and IO scheduler were perfect
(and they're so far from being perfect it is not funny) you'd still have
only so much IO bandwidth.  Also, data access patterns can matter a lot
(even on SSDs, when there are write operations).

  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh

Reply to: