Hi,
I have a WCF service in IIS7 that communicates with a winform application over TCP(WAS), now I need to monitor the performance.
I have a
It looks like this might be a bug (or a design-feature) with how performance counters work. After some poking, I've found this on the MSDN forums:
I have the same problem. It appears that Microsoft truncates the tail end of the operation name when naming the counter instance. They replace the truncated part with some sort of 2-digit base-10 magic number. I'm guessing it's a hash, but who knows how it's actually generated. The rub is that this number is not guaranteed unique and can cause collisions in counter names. If such a collision happens, it seems to cause all Endpoint and Operation counters to vanish (at least for me).
I have two methods named UpdateMarkupChunk and UpdateMarkupCancel. If I comment out one or the other so that the other doesn't exist, they both resolve to UpdateMarkupC53 in the counter instance name. When I comment them both in, none of the counter instances appear for ServiceModelEndpoint or ServiceModelOperation.
Can you suggest a workaround for this, Microsoft? I have a production service already in place that I would like to monitor, and changing the operation names is not an option.
And Microsoft responded with:
You are correct. And this behaviour is by design. There is a limit on the length of a performance counter instance's name.
Operation performance counters are found under the ServiceModelOperation 4.0.0.0 performance object when viewing with the Performance Monitor (Perfmon.exe). Each operation has an individual instance. That is, if a given contract has 10 operations, 10 operation counter instances are associated with that contract. The object instances are named using the following pattern:
(ServiceName).(ContractName).(OperationName)@(first endpoint listener address)
When a Windows Communication Foundation (WCF) counter instance name exceeds the maximum length, WCF replaces a portion of the instance name with a hash value.
So it seems because of this maximum name limitation, the large chances of a hash collision when there's only a two-digit hash suffix, and that when two instances of a counter have the same name, it wipes out the entire counter that it's not actually possible.
Which is more than a little frustrating. So unless Microsoft fixes this problem (either long hash values, or better collision handling by perf counters), or provides a suitable workaround we are working blind.