Poor results in I/O tests due to Windows Task Scheduler settings

Published by

on

Not a long ago I was doing a database cluster delivery to one of our customers and as a part of that process, I scheduled our regular set of test runs for the storage. The results of the tests we ran were bad and none of the changes we did at the SAN weren’t helping. After a while we figured out that the issue was not in the test software or at the SAN but in the scheduled tasks we used to run the different test!

There are some settings with scheduled tasks in Windows that you cannot change from the GUI. What I usually do is that once I create the tasks on the other node, I export them to XML and then copy them to another server. I usually don’t pay that much attention to these XML files, but now I started going through them to see if there was anything there that’d explain what is going on. And indeed there was one thing that caught my eye. There is a setting called a Priority in the XML files and that sounded like  something that is usually associated with scheduling threads in Windows operating systems.

Thread priority

To confirm this I quickly searched the net for the  scheduled tasks settings and found the following article explaining the Priority setting and the different values for it: TaskSettings.Priority in MSDN. It turns out that the Priority 7 equaled to BELOW_NORMAL_PRIORITY_CLASS and to THREAD_PRIORITY_BELOW_NORMAL level. I edited the value to 4 changing the class to NORMAL_PRIORITY_CLASS and level to THREAD_PRIORITY_NORMAL. After importing the edited XML to the server and running the scheduled tasks we finally got more sensible results out from our tests.

The funny thing is that I’ve run these same tests using the exactly same scripts dozens of times and I’ve never had any problems with them, until now. Despite all the extra work this put as through, there was also a positive side to this. As we were figuring out possible solutions to the problem, I did finally finish my DiskSpd test scripts to replace our old SQLIO scripts.

If you’re having issues with scheduled tasks running slowly, be sure to check the Priority setting from the exported XML.

Leave a Reply

WordPress.com.

Discover more from SQLStarters

Subscribe now to keep reading and get access to the full archive.

Continue reading