public class StringDeduplicationRule extends AbstractRule
The rule can only give guidance, it is up to the user to measure changes memory consumption after enabling string deduplication. It can still be that the amount of memory used to hold metadata of the deduplicated strings is more than the saved heap space.
Rule uses the ObjectCount event if available, otherwise the TLAB events. Uncertainties in the calculations comes both from the statistical issues that the AllocationInNewTLAB event provides, and also from the fact that it is hard to know which of the char/byte arrays that actually are the internal string arrays. Looking at the allocation stack trace can help a bit, but allocations can be missed. If using the ObjectCount event, the statistics are better, but it is impossible to know which arrays to count.
Modifier and Type | Field and Description |
---|---|
private static java.util.Collection<TypedPreference<?>> |
CONFIGURATION_ATTRIBUTES |
static TypedResult<IQuantity> |
HEAP_USAGE |
static TypedResult<java.lang.String> |
INTERNAL_STRING_TYPE |
private static java.lang.String |
NEW_LINE |
private static java.util.Map<java.lang.String,RulesToolkit.EventAvailability> |
REQUIRED_EVENTS |
private static java.util.Collection<TypedResult<?>> |
RESULT_ATTRIBUTES |
private static TypedPreference<java.lang.String> |
STRING_ARRAY_ALLOCATION_FRAMES |
private static TypedPreference<IQuantity> |
STRING_ARRAY_ALLOCATION_RATIO_AND_HEAP_USAGE_LIMIT |
private static TypedPreference<IQuantity> |
STRING_ARRAY_LIVESET_RATIO_AND_HEAP_USAGE_LIMIT |
private static IItemFilter |
STRING_FILTER |
static TypedResult<IQuantity> |
STRING_HEAP_RATIO |
evaluationTask
Constructor and Description |
---|
StringDeduplicationRule() |
Modifier and Type | Method and Description |
---|---|
private IItemFilter |
getAllocationFramesFilter(java.lang.String allocationFramesString) |
private IResult |
getAllocationRatioResult(IItemCollection items,
java.lang.String stringInternalArrayType,
IItemFilter stringInternalArrayTypeFilter,
IQuantity stringAllocationRatioLimit,
java.lang.String allocationFramesString,
java.lang.String heapInfo,
IQuantity heapUsedRatio,
java.lang.String extraGcInfo,
IPreferenceValueProvider vp) |
private IResult |
getLiveSetRatioResult(IItemCollection items,
java.lang.String stringInternalArrayType,
IItemFilter stringInternalArrayTypeFilter,
IQuantity averageStringSize,
IQuantity stringLivesetRatioAndHeapUsageLimit,
java.lang.String objectCountEventType,
java.lang.String heapInfo,
IQuantity heapUsedRatio,
java.lang.String extraGcInfo,
IPreferenceValueProvider vp) |
protected IResult |
getResult(IItemCollection items,
IPreferenceValueProvider vp,
IResultValueProvider rp) |
createEvaluation, getConfigurationAttributes, getId, getName, getRequiredEvents, getResults, getTopic
private static final java.lang.String NEW_LINE
private static final IItemFilter STRING_FILTER
private static final TypedPreference<java.lang.String> STRING_ARRAY_ALLOCATION_FRAMES
private static final TypedPreference<IQuantity> STRING_ARRAY_LIVESET_RATIO_AND_HEAP_USAGE_LIMIT
private static final TypedPreference<IQuantity> STRING_ARRAY_ALLOCATION_RATIO_AND_HEAP_USAGE_LIMIT
private static final java.util.Collection<TypedPreference<?>> CONFIGURATION_ATTRIBUTES
public static final TypedResult<IQuantity> HEAP_USAGE
public static final TypedResult<IQuantity> STRING_HEAP_RATIO
public static final TypedResult<java.lang.String> INTERNAL_STRING_TYPE
private static final java.util.Collection<TypedResult<?>> RESULT_ATTRIBUTES
private static final java.util.Map<java.lang.String,RulesToolkit.EventAvailability> REQUIRED_EVENTS
protected IResult getResult(IItemCollection items, IPreferenceValueProvider vp, IResultValueProvider rp)
getResult
in class AbstractRule
private IResult getLiveSetRatioResult(IItemCollection items, java.lang.String stringInternalArrayType, IItemFilter stringInternalArrayTypeFilter, IQuantity averageStringSize, IQuantity stringLivesetRatioAndHeapUsageLimit, java.lang.String objectCountEventType, java.lang.String heapInfo, IQuantity heapUsedRatio, java.lang.String extraGcInfo, IPreferenceValueProvider vp)
private IResult getAllocationRatioResult(IItemCollection items, java.lang.String stringInternalArrayType, IItemFilter stringInternalArrayTypeFilter, IQuantity stringAllocationRatioLimit, java.lang.String allocationFramesString, java.lang.String heapInfo, IQuantity heapUsedRatio, java.lang.String extraGcInfo, IPreferenceValueProvider vp)
private IItemFilter getAllocationFramesFilter(java.lang.String allocationFramesString)