Boosting I/O throughput of a process

Almost 6 years ago, when Windows Vista was released, I decided to switch to Linux on a day-to-day basis. I had been using Linux before, but was still using Windows on my desktop machine (I know…pretty foolish). The other day I was glad I made that switch a few years ago.

I was creating a HEAP dump, that is a snapshot of all objects in memory, of a JBoss server. A HEAP dump really dumps everything, so if your JBoss (or Tomcat or whatever) process is occupying 4GB of memory, it will dump the whole 4GB in a nice file for you to analyze later on (which is the whole idea behind dumping the HEAP).

Really cool stuff, but not so cool if you see that the dump file only grows 2MB each 10 seconds. What the hell?! I’ll be old and gray before the dump has finished!!! Linux power to the rescue!

The Linux operating system has an I/O scheduler ( that tries to prioritize process I/O requests in the best possible way. It’s clear that it isn’t giving my dump process the highest priority, so let’s tell Linux to do so: Say hi to ionice.

ionice -c class -n classlevel -p PROCESS_ID


1 (real time): First priority is given to the process, regardless of other I/O requests.

2 (best-effort): The default priority class for a process

3 (idle): The process will only get I/O time when no other program has requested I/O time.


A number from 0 to 7 indicating the time slice the process will receive on each scheduling window, where 0 is the highest priority (process gets more I/O time) and 7 is the lowest (process gets less I/O time).

Depending the class and level, the process is given a priority. Beware using the real time priority class as it might choke other processes needing some I/O time.

In my case I used the best-effort class with the highest priority (0). Magic happened, instead of seeing the dump file increased by 2MB per 10 seconds, it was now bumped up to a rate of 10MB/s, AWOOT!!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s