Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Win Service CPU Usage

Status
Not open for further replies.

Becks25Not

Programmer
Jun 23, 2004
176
US
Hello All,

I have a windows service that works as it should. My server admin has a concern because when it runs, it will use up to 95% of the CPU. It frees up all the resources and memory usage when it was done but he is concerned about the spikes. I tried setting the thread to BelowNormal with no effect. I set the thread to IsBackground which also had no effect.

Any ideas on how to keep it from taking so much?
Thanks!
Becca
 
IsBackground will only effect the applications performance when that thread closes. It is used to keep an application alive if the primary thread ends, but there are still background threads active.

I wouldn't be too worried unless other applications are being throttled. With your app set to below normal importance, other apps should take priority for processing resources, but if no other apps are requiring more than 5% of the processor, then it doesn't matter if your app it taking 95%. Try running another application while the service is hitting a lot of processor intensive work. If your app (say like opening Office) doesn't take the processing % it needs, then you may want to investigate further.

-Rick

VB.Net Forum forum796 forum855 ASP.NET Forum
[monkey]I believe in killer coding ninja monkeys.[monkey]
 
On a side note, Microsoft's anti spyware tool runs a full computer scan on the filesystem during "non-peak" times.

The computer goes el non respondo (for about 15 mins) and the only way to shut it off is will an "End Process"

Last time i checked, late afternoon was peak time at my house.

SWM Programmer Seeking 3d Modeling work. Either for long term commitment or just friendship. Likes long hours in front of a flat screen with heavy doses of Mountain Dew.
 
Thanks for responding. The app literally takes less than 1 minute to run althrough it runs every 5 minutes from 6AM to 7PM.

Does anyone know if this is standard behavior of a windows service? Is there a way to cap the amount of CPU time it can take?

THanks!!
Becca
 
I was looking into this more at the code since it was just this one. It uses the OracleClient and the others don't. I switched the data source to point to our production (read only) and the spikes are for shorter time periods (production is faster than test!!).

As anyone worked with or dealt with the OracleClient being a CPU hog? Ant ideas around this? I am concerned because we would be using the Oracle Client in Win Apps as well and being that kind of a hog isn't really acceptable on a client machine. (Obviously need to test that it really is the OracleClient and the behavior would be the same)

Thanks!
Becca
 
What does your code do when there's no work for it to perform? Does it use a timer to wait for 10 seconds or something? Or does it immediately loop back and query the DB for more work?

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Sorry for the late reply --

The Win Service fires with a timer ever 5 minutes.

We have determined that it is the Oracle Client with our Development databases. (not necessarily the service)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top