Question

is there any way to throttle the cpu usage of a windows service that is written in .NET, either inside the service code or outside. Setting the current thread to the lowest priority is not an option but as soon as exceptions start to occur the cpu load goes up, is it possible to limit this?

Was it helpful?

Solution

These days’ memory band-width and usage of the processor cache is as match of a problem is CPU time.

I don’t know of a OS that has kept up...

You could try using a Thread.Sleep to sleep for 50% of the wall time, messy but may work.

OTHER TIPS

You need to take a closer look at your application. Why is it throwing exceptions, and why are those exceptions using so much CPU?

If you need to control the CPU usage from outside of the code I would suggest using ThreadMaster http://threadmaster.tripod.com/ It's a little outdated but I've used it in the past and it was able to successfully resolve my issue.

This isn't ideal for a long term solution, but could be a good tool in some specific scenarios.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top