Automating Windows Process Priority
Recently, I have seen one of the mail server performance I am working on has been dragging down which causes webmail / POP3 to be slow down. It takes me up some times to diagnose on the source of the problems and eventually the drive I/O is the cause of the issue. Well…. upgrading drives by mirroring is pain in ass as it involve down time and I will need to stand by at the data center for the whole night again.
Doing some research on the Net, it cames to my attention that we can prioritize the process running in the Windows background to receive more processing power from the server compare to other processes just like what we have in Linux by seeing on their ‘nice’ status.
We can prioritize the processes through the Windows Task Manager or by using the Sysinternal tools – ProcessExplorer to do the trick. Now question is, how do you reset the processes which constantly being restarted – such as IIS w3wp.exe worker processes after its application pool recycling in Windows 2003? Manually? Wow… you will then need to spend 24 hours sitting in front of your terminal for that.
I have asked around and doing some Googling, and at last, I came to this TechNet article – Modifying Process Startup Options which helps to save my ass from sitting in front the terminal for 24 hours.
Below is the sample scripts. Generally, you will just need to replace the ‘PriorityClass’ and the ‘ProcessName’ ( w3wp.exe ) with your actual process name and voila, you are ready to go. If you want this to be automated, you may setup a cron batch file to auto run it for how often as you need.
Const High = 128
strComputer = “.”
Set objWMIService = GetObject(“winmgmts:” & “{impersonationLevel=impersonate}!\\” & strComputer & “\root\cimv2″)
Set colProcesses = objWMIService.ExecQuery(“Select * from Win32_Process Where Name = ‘w3wp.exe’”)
For Each objProcess in colProcesses
objProcess.SetPriority(High)
Next
Post comment
Categories
Recent Posts
- yum update – TypeError: unsubscriptable object
- Magento with Windows IIS
- Helm3 : File Manager Not Showing any Files
- Helm4 Error on Remove Domain
- SQL 2008 Maintenance Plan Execution Error
Recent Comments
- Superrookie on Cannot create Windows Service for MySQL.Error:0
- Martin on Cannot create Windows Service for MySQL.Error:0
- About MySQL.Error On Windows 7 | Robin Blog - UED, Open source, SEO, Marketing on Cannot create Windows Service for MySQL.Error:0
- Totally Frustrated MySQL Newbie on Cannot create Windows Service for MySQL.Error:0
- Simon on Cannot create Windows Service for MySQL.Error:0

