Link to home
Start Free TrialLog in
Avatar of AidenA
AidenA

asked on

using performance counters in asp.net (vb). What kind of useful information can I get?

Hi,

Just want to learn a bit about performance counters in vb.net website. I created something like below and was able to display the results in a gridview ok.

So, the only problem is I don't really know what I'm looking at or what use it is. And I don't really know what I should be looking at. Seems hard to find useful info in google on this.

Any info on this?

Thanks, Aiden
Dim perfAppRestarts As New PerformanceCounter("ASP.NET", "Application Restarts")
      Dim perfFreeMem As New PerformanceCounter("Memory", "Available MBytes")
      Dim perfRequestBytesOutTotal As PerformanceCounter = New PerformanceCounter("ASP.NET Applications", "Request Bytes Out Total", "__Total__", True) 'Readonly True

Open in new window

Avatar of GlobaLevel
GlobaLevel
Flag of United States of America image

Avatar of AidenA
AidenA

ASKER

Hi thanks, but that doesn't really help. I can find information on performance counters... I'm just not sure how to interpret it and how I can use this information to improve my app or find errors / bugs / bottlenecks.

For instance, one site was saying to use the performance counters below (or some of them). And you can see I have some info on them. Great. But, how does that help me exactly? Most of those counters appear to be equal to zero on the server anyway....

Dim perfAppRestarts As New PerformanceCounter("ASP.NET", "Application Restarts") 'The number of times that an application has been restarted. This counter increments with each Application_end event but is reset if IIS is restarted.
      Dim perfRequestsQueued As New PerformanceCounter("ASP.NET", "Requests Queued") 'The number of requests waiting for service
      Dim perfRequestsSec As New PerformanceCounter("ASP.NET Applications", "Requests/Sec", "__Total__", True) 'Readonly True 'The number of requests executed per second.
      Dim perfFreeMem As New PerformanceCounter("Memory", "Available MBytes")
      Dim perfRequestBytesOutTotal As New PerformanceCounter("ASP.NET Applications", "Request Bytes Out Total", "__Total__", True) 'Readonly True
      Dim perfErrorsTotal As New PerformanceCounter("ASP.NET Applications", "Errors Total", "__Total__", True) 'Readonly True 'The total number of errors that occurred during the execution of HTTP requests
      Dim perfErrorsTotalSec As New PerformanceCounter("ASP.NET Applications", "Errors Total/Sec", "__Total__", True) 'Readonly True 'The number of errors per second.
      Dim perfPipeline As New PerformanceCounter("ASP.NET Applications", "Pipeline Instance Count", "__Total__", True) 'Readonly True 'The number of active pipeline instances.
      Dim perfExceptions As New PerformanceCounter(".NET CLR Exceptions", "# of Exceps Thrown", "_Global_", True) 'Readonly True 'The total number of exceptions thrown.
      Dim perfContextSwitchesSec As New PerformanceCounter("System", "Context Switches/Sec") 'A context switch occurs when the kernel switches the processor from one thread to another, for example, when a thread with a higher priority than the running thread becomes ready. Context switching activity is important for several reasons. A program that monopolizes the processor lowers the rate of context switches because it does not allow much processor time for the other processes threads. A high rate of context switching means that the processor is being shared repeatedly, for example, by many threads of equal priority. A high context-switch rate often indicates that there are too many threads competing for the processors on the system.

Open in new window

SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of AidenA

ASKER

Hi sorry a lot of stuff there so only found the time to read through now. So, there's lots of stuff on performance counters there, but really only on how to create your own performance counter to measure something that you want to measure.

But it still doesn't talk about which performance counters are useful for measuring the performance of your website, or what kind of performance counters you should create in order to measure performance of your website. So, I'm really still in the same situation of not really knowing how to get the best out of performance counters.

I suppose I could create a counter which measures how often a page is hit (and then show that value per day over the last week)... or something like that... but one of those pages was suggesting that you shouldn't run in production anyway, so I don't want to create something that will not be useful on going or that will affect performance unnecessarily (as I'm just curious really). So, just want the basics on what it is I should measure and how to interpret that
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Did you read the 3rd link?
Avatar of AidenA

ASKER

ok think maybe i'm getting it now. Codecruiser, yeah I read that, but it still didn't click with me as I was thinking in terms of programatically dealing with these performance counters, in which case I was getting zero for most of those values as I just printed them out to a gridview (but not over a particular time frame)... but as GlobaLevel points out, maybe that's only useful for absolute values (maybe such as application restarts or I don't know what).

So, ok, I've seen those counters in action from the 3rd link. One question though... three of them (anonymous requests, requests total and requests succeeded) don't have a baseline of zero so I can see that they build up as requests come in. But, when do they start at zero? Is it after an application rest, or an iis reset or something?

GlobaLevel, what you're talking about sounds perfect... so what performance counters do you use? I should just add these then to the performance monitor or do I need to do some manipulation?