An Experimental Study on the Behavioural Tendencies of Objects Classified As Hot and Cold by a Java Virtual Machine Garbage Collector

Hanna Nyblom


Abstract

A constitutive hypothesis of the Java Virtual Machine garbage collector "ThinGC", Mingkun Yang et al. [1], an extension of Oracle's "ZGC", is that capitalising on possible temporal locality could optimise collection by limiting the total number of objects to manage. To achieve GC optimisations, ThinGC classifies objects as hot (recently referenced) or cold, separates the hot and cold objects into distinct memory spaces, and collects the spaces separately using two garbage collectors.

In order to examine to what extent this temporal locality can actually be observed, this thesis analyses the behaviour of objects classified as hot and cold by ThinGC. Reviewed behaviour includes: tendency of cold objects to remain cold, expected length of cold streaks, and if the tendency to remain cold or hot is related to the type of the object.

In order to examine object behaviour, hotness information for all objects in the DaCapo benchmark suite is logged in each GC cycle of ThinGC. The hotness information of each object is then compiled following address forwardings, and metrics estimating the behaviour of each object is calculated.

Analysis of the charts and tables presenting the results of the metric calculations show, for instance, that "reheats" of objects are uncommon, cold objects usually stay steadily cold, and long cold streaks are more common than long hot streaks.

The results highlights distinctly different behaviours of hot and cold objects and indicate that the concept of classifying objects by hotness and treating cold objects separately could be well-founded.

The results also show some classes of objects being more or less likely to stay cold. If these class behaviours could be proven to be reliable examining a larger set of programs, the information could be useful as a baseline for GC tuning. Also if hotness information were collected, and similar metrics calculated concurrently, this information could aid in live GC decision making.

[1] Albert Mingkun Yang et al. “ThinGC: Complete Isolation With MarginalOverhead.” Submitted.