“You can’t control what you can’t measure”1 and you want to control things, you don’t want to just bet on luck. Nonetheless measuring is not enough, you also need to know how to interpret results of such measurements.
It’s not hard to find examples of misinterpreted measurement results with the free2 command output being the most commonly misinterpreted one. Often lack of understanding of used terminology or its ambiguity can be accounted for it. For example, let’s look at jstat output for a Java process:
Anyone knowing JVM Garbage Collection basics should have no trouble telling what those values mean, shouldn’t he? Well let’s try: EC stands for Eden space Capacity, EU denotes Eden space Usage, S0C - Survivor space 0 Capacity, YGC - the number of Young generation Garbage Collections, YGCT - Young generation Garbage Collection Time, and so on.
Pretty obvious, isn’t it? So let’s gather statistics for the old generation (and metaspace) and answer the question how many Full GCs were performed?
If your answer is 4 you might be correct or far from being correct.It all depends on which garbage collector monitored Java process is using. For Parallel GC 4 is the correct answer, but for CMS, the correct3 answer is 2. If you don’t believe me, check the GC logs from the same Java process run:
jstat man-pages say that FGC stands for the number of Full GC events, so let’s take another look at the GC logs, this time limiting them to single CMS cycle:
You can clearly see that CMS performs its work in several phases but just 2 of them (Initial Mark and Final Remark) count as GC events, only those that are stop-the-world phases.
Should you measure something be sure what you really measure otherwise the results can keep you far from reality. Always validate your assumptions and RTFM!
BloomReach CMS: the API-first CMS of the future. Open-source & enterprise-grade. - As a Java developer, you will feel at home using Maven builds and your favorite IDE (e.g. Eclipse or IntelliJ) and continuous integration server (e.g. Jenkins). Manage your Java objects using Spring Framework, write your templates in JSP or Freemarker. Try for free.