throttle IO operations

  • Thread starter Thread starter colson
  • Start date Start date
C

colson

I have an indexer thread running continuously. I want to set the
priority of IO operations performed in this thread to LOW (in similar
vein to setting CPU priority to low on a thread). How do I do this?
 
Unfortunately, there's not really a "IO priority" setting. It's largely
first come, first serve.

It think one of the best ways to do this would be to space out the IO over
time, putting in a hard Sleep time. Then try do the IO in good-sized chunks.
This is much better than a lot of very small IO operations and there are
several reasons for that.

First of all, if you're competing with other apps, or the swap file, or the
user doing other stuff with the disk, doing the IO operations in chunks will
minimize how much the disk heads have to hop back and forth between the
indexing and whatever else is competing with it.

More importantly, if you're writing, and other apps are writing, if you do a
lot of small writes, you'll end up with more fragmentation, as the OS is
likely to do a bit of your file, followed by a bit of competing app file,
followed by a bit of your file, and so on. Writing in sizable chunks, you'll
end up with less disk fragmentation and better overall performance.

Anyway, that's just my opinion.

Pete
 
Peter,

While this will affect execution priority of the thread, it won't have a
great deal of impact on IO, unless there's a good deal of processing between
individual IO operations.

Pete
 
What is the .NET way to monitor disk activity? I can just pause the
indexer when disk activity is high.
 
There may be a way to do it with WMI. The only other thing I can think of is
to check the performance counters.

Pete
 
Back
Top