[
https://issues.apache.org/jira/browse/OAK-4987?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15608814#comment-15608814
]
Michael Dürig commented on OAK-4987:
------------------------------------
It is generally hard to correctly estimate the memory requirements of Java
instances. This will probably even differ between JREs and Java versions.
Furthermore such estimates are problematic to maintain: simple changes i.e. in
the way we implement segment references might make them obsolete again.
One thing we could try doing is instead of caching {{Segment}} instances is to
just cache the raw data {{byte[]}} and instantiate the segment on the fly when
fetched from the cache.
> Segment objects under-report their size for the cache
> -----------------------------------------------------
>
> Key: OAK-4987
> URL: https://issues.apache.org/jira/browse/OAK-4987
> Project: Jackrabbit Oak
> Issue Type: Bug
> Components: segment-tar
> Reporter: Alex Parvulescu
> Fix For: 1.5.14
>
>
> The {{SegmentCache}} expects each {{Segment}} object to report its own size,
> which will then be used to properly keep the cache within the configured
> bounds [0]. If a {{Segment}} object is unable to accurately account for its
> own size the global cache will have a size that is a lot bigger than the
> expected value:
> {noformat}
> Class Name
> | Shallow Heap | Retained Heap | Percentage
> -------------------------------------------------------------------------------------------------------------------------
> org.apache.jackrabbit.oak.segment.Segment @ 0x6cd906df0
> | 48 | 1 439 728 | 0,09%
> |- org.apache.jackrabbit.oak.segment.ImmutableRecordNumbers @ 0x6cd906e50
> | 16 | 1 177 432 | 0,07%
> |- java.nio.HeapByteBuffer @ 0x6cd906e20
> | 48 | 262 208 | 0,02%
> |- org.apache.jackrabbit.oak.segment.ImmutableSegmentReferences @
> 0x6ce0a0880| 16 | 40 | 0,00%
> -------------------------------------------------------------------------------------------------------------------------
> {noformat}
> This is pre OAK-4872, so the objects won't match anymore, but the core issue
> is still there (segment size needs to account for {{segmentReferences}} and
> {{recordNumbers}}).
> [0]
> https://github.com/apache/jackrabbit-oak/blob/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentCache.java#L53
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)