[.net] Process Monitoring

Started by
5 comments, last by wackatronic 18 years, 3 months ago
I am building a backend system for gaming that will monitor processes on local and remote machines. Since I am looking to provide the most un-intrusive method of monitoring these processes, I am hoping someone with a little more experience can offer some insight. We will be running processes on Windows servers and looking at the following information about a given processes: Memory Usage Thread Usage CPU Usage I know of two possible scenarios for monitoring processes. 1. Use the built in Performance counters and monitor these through C#. 2. Attach to processes and use custom monitoring and polling of the processes for their information. Any help is much appreciated.
Fear is the mind killer. But if you have no mind, do you have no fear?
Advertisement
Performance counters are a piece of cake to use from managed code (especially compared to the equivalent unmanaged code).

They also have the advantage that you can do it remotely (at least assume both machines are on the same domain, or belong to trusted domains). That's probably not that likely in a typical client/server environment though.
What about performance hits? Does one method use more memory/resources over another?

Using them is easy but I'm looking to minimize usage when retrieving data. I would pull data estimated at every 5 secs or more.
Fear is the mind killer. But if you have no mind, do you have no fear?
I think the overhead is fairly limited. Obviously, things like memory or CPU usage are already tracked by the system anyway. I have noticed though, that querying this kind of information from a remote server does take some time. I have build a web application that shows statistics for about ten servers, including memory usage, number of anonymous users per application, SQL server connections etc. It may have something to do with the connection (and the related security processes) to the server itself, rather then the collection of the requested information. The system doesn't keep the connection alive (like an open pipeline or at least a connection pool), but it reconnects every time the users ask for a refresh of information. I guess these are issues to take into account.

I do wonder though, what the value in polling things like CPU time every 5 seconds is. Depending on the applications running on the server, these statistics can fluctuate heavily even in short periods of time. It's not impossible to imagine the polling of data itself has a significant influence on these statistics.
Quote:Original post by WanMaster
I do wonder though, what the value in polling things like CPU time every 5 seconds is. Depending on the applications running on the server, these statistics can fluctuate heavily even in short periods of time. It's not impossible to imagine the polling of data itself has a significant influence on these statistics.


The service I'm writing to control the processes on the servers' backend is going to be configurable per process concerning poll time. The 5 second was just a generalization.

Since you brought up a very valid point as far as CPU (and I assume memory), is there some type of built in alert systems within the Windows subsystems?
Fear is the mind killer. But if you have no mind, do you have no fear?
I've been writing a System Monitor for our production servers at work using C# and WMI via a web service. Haven't noticed any performance degradation on the monitored machines from doing this, and im polling CPU and process information every 5-10 seconds. So my recommendation would be to go with the built in WMI functions and classes.
Blake's 7 RPG - a new project
Quote:Original post by Strewth
I've been writing a System Monitor for our production servers at work using C# and WMI via a web service. Haven't noticed any performance degradation on the monitored machines from doing this, and im polling CPU and process information every 5-10 seconds. So my recommendation would be to go with the built in WMI functions and classes.


So you are creating perfromance logs and then calling them through WMI? This monitor is part of a larger system and I was worried about the users not being savvy enough to create logs. I may look at this as an approach, but I was hoping to add more functionality to control messaging to the monitored processes.

Fear is the mind killer. But if you have no mind, do you have no fear?

This topic is closed to new replies.

Advertisement