4

I'm running some perfmon counters / reports on an Windows Server 2003 IIS6 web server, that has each web site running under its own application pool/worker process user.

The report is providing the names of the sites as, for example:

w3wp#29
w3wp#30
w3wp#31
w3wp#32

I need the worker process names (or PID) so I can determine which web site each relates to.

The #29, #30, #31, etc numbers are not PIDs, because when I enable PID view in Task Manager or if I enable the 'Command Line' column in Sysinternals Process Manager, or use the iisapp.vbs script - the PID's are longer numbers.

I haven't been able to find anything to convert the above processes into the application pool user name or at least the PID so I can cross reference it to the site using the iisapp.vbs script.

I researched this and did come across a registry setting that may do what I'm looking for but unless there's not other way I don't want to make registry changes:

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PerfProc\Performance]
"ProcessNameFormat"=dword:00000002

Any ideas on how to look up or convert the w3wp#XX processes to either application pool username or PID?

Thanks

nat
  • 63
  • 1
  • 2
  • 4

2 Answers2

5

To cross-reference, you can use the process counter "ID Process". Include that in the perf data and it will show the PID for the process. That's fine for a one-off cross reference but it's a bit of a pain.

I still recommend the registry change if you can do it. In my opinion, the registry change should be part of any base build.

Here's a blog post that covers the same and confirms the registry change: http://weblogs.asp.net/owscott/archive/2007/03/19/registry-change-for-perfmon-and-pid-data.aspx

Scott Forsyth
  • 16,339
  • 3
  • 36
  • 55
  • 1
    Thanks, I will probably do that. Do you know of any setting that will also add or display the worker process name associated with that PID? (ie - the name next to the PID when you run iisapp.vbs) In terms of running a report that will be looked at later... by then the PID may no longer be running or have changed. – nat Nov 08 '09 at 20:03
  • There isn't any history logged of PIDs to app pools in the OS that I'm aware of. System Center Operations Manager (SCOM) can do logging for you and will keep track of app pools. That's good for a long term solution. If you do it manually like you are (I've done it many times myself), what you need to do is refresh the collection data often and save a copy of iisapp each time you do. i.e. twice per day restart the counters and re-select all w3wp.exe processes and then run iisapp from the command line and save to file with a timestamp on it. – Scott Forsyth Nov 08 '09 at 21:27
  • Thanks, I did the registry change, ran perfmon and processed the log through PAL, and got mixed results... In some of the results (processor time, disk i/o), I got what I was was looking for (i.e. - w3wp_34543), which is great. But in other sections (.NET exceptions, .NET CLR Memory, etc), it read as the w3wp#43 numbers. I can live I guess without the .NET section but I'm curious why the registry change helped some sections of the logging and not others (?) – nat Nov 10 '09 at 04:57
  • I haven't seen that, but my guess is that it doesn't use the new method until after a process restarts, so if you didn't reboot, it will take a while for all processes to restart, unless you do a server reboot. – Scott Forsyth Nov 10 '09 at 13:56
1

Old bump, but you can use the sysinternals utility PROCEXP and add the "Command Line" column to see which pool is running in which w3wp process.