Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I was wondering if there are any free / open source solutions that will start and stop a windows service based on load? I have some pubsub subscriber services that do background work which is not critical. Ideally i would like tot be able to automate things so that these services could start if memory/cpu/disk i/o was under a certain threshold and stop gracefully if that threshold was met. Do you know of any solutions? Thanks JP

share|improve this question

migrated from stackoverflow.com Jun 7 '10 at 8:04

This question came from our site for professional and enthusiast programmers.

3 Answers 3

up vote 1 down vote accepted

There is software built into windows that does this called Windows System Resource Manager (WSRM) it will do what you want i.e. priorities services based on resources.

Obviously not opensource, but comes with the OS.

share|improve this answer

I'm not aware of an external tool, but you could monitor relevant performance counters inside your service and do no work (sleep for some time period) if performance counters you think are relevant exceed thresholds. This would not be quite the same as stopping the service (it would still be resident in memory), but should achieve the desired end.

One benefit of this approach is that you don't have to worry about setting up and configuring an external tool, or monitoring that the external tool is still working.

share|improve this answer

You could setup an alert that could run on fixed threshold (say CPU>=75) To setup an alert on windows here is a link http://support.microsoft.com/kb/324752

So you could setup an alert for the condition CPU Usage >=75% and as the command line you could use

      net stop svcName 

This stops the service called svcName.

You could have another alert defined to the opposite CPU Usage < 70% and as the command line you could use

      net start svcName 

when you it falls below the thresholds.

I kept 5% margin between on and off, though you could create a batch file to delay starting and stopping the service too often.

Hope this helps

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.