Being 'nice' with I/O: limiting a processes I/O resources in *nix

6

2

I'm working on a big shared Ubuntu server and am annoying my colleagues. One of my processes is making a lot of inserts into a MySQL database and it's bogging the whole server down.

MySQL is not using much of the CPU resources nor much of the RAM. If that were the case I could use the tools 'nice' and 'ulimit' to throttle the process (in fact I am using nice on MySQL and it's not helping). Instead, MySQL seems to be making lots of random disk read and write operations and so whenever anyone else wants to read or write a file from disk, they have to wait a second or two, which is not acceptable for interactive use.

Any thoughts on what I can do to limit MySQL's disk I/O? (I'm looking for an OS or kernel level solution rather than a suggestion to change the hardware setup of my system).

What I need is well described in a message board here.

conradlee

Posted 2012-01-17T00:38:20.680

Reputation: 163

Answers

5

ionice (part of util-linux) can adjust the I/O priority of a process, allowing to select between idle, 8 "best effort" and 8 realtime priority levels. Class 3 is "idle":

ionice -c 3 -p $(pgrep -x mysqld)

schedtool can adjust the general scheduling policy, again with "idle" being one of the choices:

schedtool -D $(pgrep -x mysqld)

user1686

Posted 2012-01-17T00:38:20.680

Reputation: 283 655