I have a few perfmon performance counters that I'd like to track for a specific ASP.NET application over an extended period of time, say a week or a month. The trouble is that perfmon counters are generally process-centric, rather than ASP.NET application-centric, or AppPool-centric. So, for example, I can bind the counter
.NET CLR Memory performance counters\# Gen 0 Collections
to a specific IIS worker process (which, annoyingly, is identified via w3wp, w3wp#1, w3wp#2 -- but for a fix for that, see How to convert 'w3wp' process names to PIDs or usernames? (i.e.- "w3wp#29)), but I can't seem to bind it to "whatever process, now or in the future, that happens to be running ASP.NET Application X, or AppPool Y". This means that, if IIS recycles the worker process, or if someone restarts IIS, or restarts the machine, then my perfmon logs can't be counted on to keep tracking the same web application.
Is there some trick to use perfmon to monitor a given webapp even if the worker process (e.g. w3wp.exe) restarts, the machine restarts, etc.?
There are a couple of potential answers I've found searching other questions here, but they don't feel 100% right (though I'll upvote explanations of why they might, in fact, be right):
- From How to setup Perfmon/Logman to get the Thread performance counters for only a specific IIS process? I get the impression that perhaps I could log all the "# Gen 0 Collections" counts for all the separate .NET apps on the machine, and then after the fact throw out the ones that were not relevant. But first I don't know how to log the counts for all apps (note: critically, you need "all the apps, regardless of when they were started", not "all the apps that were started when you set up your perfmon task"), and second I don't know how you'd retroactively tell which data in the logs corresponded to your particular webapp
- From How to make Perfmon automatically track same process for IIS with multiple sites? I get the impression that this could perhaps be solved with a script that kept going in and tweaking the perfmon counter settings every minute or so, based on the output of iisapp.vbs. But that doesn't seem like a very clean way to do it.
0 Answers