Often, the bottleneck of my laptop is the disk. When doing some disk-intensive computations, automatically-started background processes like updatedb, find /something etc. kick in, making things even worse. They are set to be nice, but it doesn't help since CPU is not the problem, I/O is.

The question: what to do to alleviate the problem (short of killing them manually), and more generally, is there a mechanism like nice, but taking I/O into account?

Even more generally, how to improve I/O responsiveness of a Linux (Ubuntu 14.04) system? At present, when one app is maxing out disk usage, the system is veeeery slow to respond - for example, it takes forever to open a web page in Firefox (even though the system is not swapping; it get worse when it is swapping). Swappiness is set to 0, it it matters.

  1. Have you taken a look at ionice?
  2. You may want to run updatedb/find with posix fadvise to inform the OS that you don't want these programs to dirty your page cache. That way, your cached disk i/o stays in memory.
  3. You can also rework your cron jobs to have these background processes pushed to times when your computations are not running. Additionally, you might mod the cron jobs to first find out whether your disk is busy prior to starting (if iostat -x, says that the disk is busy, then sleep for an hour and try again)
  4. I/O on laptops may suck esp if your laptop is doing 5400RPM. You may want to try adding some ram so that you can utilise your page cache.
  5. Firefox being slow is actually an interesting problem. At my previous job, we had this exact problem. If I remember right, Linux aggressively prefers to keep your i/o pages cached in memory. It will even go to the extent of swapping out program memory (i.e. firefox). So when you go fire up firefox, Linux will have to swap out some other app to create some space, swap in firefox and attend to your request...
  • +1 WRT to your last point about swapping program memory out to save the page cache, this behaviour is configurable via /proc: en.wikipedia.org/wiki/Swappiness (except the OP has already made mention of this, so that's not the issue in this case). – goldilocks Nov 5 '14 at 20:53
  • YMMV: We did try to play around with swappiness unsuccessfully. We tried all kind of values, graphed stuff and didn't get anywhere. We eventually ended writing up a daemon that would evict the pages of certain misbehaving programs every few seconds from the page cache. – Lmwangi Nov 5 '14 at 21:07
  • Thank you, references to ionice and iostat have been very helpful. – Nucular Nov 8 '14 at 20:55

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.