views:

356

answers:

2

I want create some type of ASP.NET (C# 2.0) Metrics class to help monitor the performance of a production web application. I am somewhat familiar with the 2.0 Health Monitoring and that is not what I am looking for (I don't think anyway). I would rather have a dashboard that gives me a snap shot as opposed a log or list of events. I would appreciate any feedback from the community. So even if you don't have a specific answer, feel free to add your input to any part and don't feel like you have to provide input on the whole thing. Thanks in advance!

Below are some of the things I would like to monitor. Values should be specific to the application and not IIS.

  1. Number of open sessions
  2. Hits per hour
  3. Oldest session
  4. Amount of allocated memory and usage
  5. **Average runtime spent in each (or a given) function.
  6. Last exception (handled or un-handled)
  7. Bandwidth utilization (is that even possible at the application level?)

**For number 5, I was thinking about using some type of stopwatch class. Each function I want to monitor will call start/stop as it begins and ends its execution. However that seems horribly ugly to me. Is there a way to do this without a stopwatch class? Can something in the Reflections class help with this?

Does something like this already exist? I have done a fair amount of Googling but can't find exactly what I am looking for.

Can you recommend any other metrics I should look at?

+1  A: 

You should be able to read Windows performance counters to get most of this information. Bandwidth utilization is hard at the application level. I ended up building a sort of counter into my application to track bandwidth. I'm sure it could be done more efficiently by going down lower in the stack, but I just needed something quick and dirty anyway.

dnewcome
+1 I thought bandwidth would be trouble. How did you do it? Just count number of bytes of each response/request? Do you know if there is a way to see bandwidth usage per virtual directory?
J.Hendrix
You can get per-site bandwidth stats from the Web Service group of performance counters (Bytes Sent/sec, Bytes Received/sec, Bytes Total/sec). GET requests/sec from that group is also useful.
RickNZ
+1  A: 

It sounds like much of what you're looking for can be captured with Windows Performance Counters. You could read them from your dashboard page, and display them in HTML.

You can also create custom counters for any app-specific data. One of my favorites is to measure how long out of process calls take, and count the number of times they exceed some pre-determined threshold, to look for performance problems or regressions.

RickNZ
+1 I will start looking at this. I have found something on CodeProject. Let me know if you know of any better resources. Thanks!http://www.codeproject.com/KB/dotnet/perfcounter.aspx
J.Hendrix
In case it might help, I cover custom performance counters in my book: Ultra-Fast ASP.NET.
RickNZ
Thanks. I will take a look. I'm sure my company will be willing to float the $30.
J.Hendrix