AVERAGE CPU USAGE AND GC
Looking at only the average CPU during a test misses the interesting picture of what happens dur-
ing GC cycles. The throughput collector will (by default) consume 100% of the CPU available on
the machine while it runs, so a more accurate representation of the CPU usage during this test is
shown in Figure 5-2 .
Most of the time, only the application thread is running, consuming 25% of the total CPU. When
GC kicks in, 100% of the CPU is consumed. Hence, the actual CPU usage resembles the sawtooth
pattern in the graph, even though the average during the test is reported as the value of the straight
Figure 5-2. Actual versus average CPU usage (throughput)
The effect is different in a concurrent collector, when there are background thread(s) running con-
currently with the application threads. In that case, a graph of the CPU might look like Figure 5-3 .