views:

154

answers:

2

We found that, since today, the "% Time in GC" (percent time in Garbage Collector) performance timer, steadily stood on 100% with only occasionally a bit lower. Even when at night no visitors were online.

Then I placed App_Offline.htm in the root. Usually this brings down all ASP.NET activity. But for some odd reason, the "% Time in GC", while lowered to 34%, remained steady.

Am I looking over something obvious here? Some other GC related performance counters also seem to still act, but marginally.

EDIT: I had written "only today", but it's really "since today". It hasn't gone away since.

+2  A: 

If the application is performing no work most of the time (say 1% of the time is actual work at individual moments throughout the day, but for the whole day it is more like .0000001%), then wouldn't that mean that, when work is being done, it is GC work? If there is only .0000001% of work being done by the web application for the whole day, then it certainly seems logical that 100% (for all intents and purposes) of the total work done for the whole day IS done by the GC. The GC will run periodically regardless of work being done, and if there is no other work being done...

Or am I misunderstanding the question?

jrista
No, you are not misunderstanding the question. But you're conclusion is not the solution. +1, because it did bring me on the track of a solution. I misinterpreted the counter. I'll update with an answer containing the actual solution. Thanks!
Abel
Well, good to know its not an accumulated value, but the last measured value. That makes even more sense. Glad you got it figured. :)
jrista
+1  A: 

Jrista pointed in the right direction with his answer, but the actual reason of this behavior turned out to be rather different:

The "% Time in GC" counter is not a realtime counter. Instead, it shows the last value measured when the last GC happened. When you close your web application with App_Offline.htm, the GC will run and take a certain percentage. After that, the CLR is totally inactive (the purpose os App_Offline), so no further garbage collections will happen and the percentage remains the same. Hence the straight line, even when ASP.NET CLR activity is zero.

Here's a description of this counter, which I copied here for reference (and to remind myself to read the explanation of a counter before asking silly questions).

% Time in GC is the percentage of elapsed time that was spent in performing a garbage collection (GC) since the last GC cycle. This counter is usually an indicator of the work done by the Garbage Collector on behalf of the application to collect and compact memory. This counter is updated only at the end of every GC and the counter value reflects the last observed value; its not an average.

Abel
So let me get this straight, because I am thinking this counter might have helpful data for me, the way I read it says: If the GC finishes, and then 40 seconds later starts up, and finishes 20 seconds afterwards, it would be 30% Time in GC because of the 60 seconds since previous GC finished, 20 of them were in new GC?
Jimmy Hoffa
The way I see it, it means that *during* a GC cycle, it took XX% of the overall time off of the application's time. If there are many cycles and the numbers are continuously high, it is an indication that your GC is going bonkers. A GC cycle does not mean that your program is stopped and must wait until the GC finishes.
Abel