[ 
https://issues.apache.org/jira/browse/OAK-4966?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15608650#comment-15608650
 ] 

Michael Dürig commented on OAK-4966:
------------------------------------

My general concern here are all those estimates for memory consumption of 
nodes, templates and strings. They may hold for one repository but might be 
completely off for another one. Furthermore they are hard to maintain going 
forward. Slight changes in the code might greatly affect how much memory e.g. a 
node needs. 
Also checking memory up front doesn't account for the case where a memory 
intensive operation is started on an instance where gc is already running. 

What about a simpler (I think so) approach where we check the available memory 
say once a second during compaction. Once memory is below a certain threshold 
for say 10 subsequent checks, we just cancel gc? This should be quite simple to 
implement in {{FileStore.GarbageCollector.CancelCompactionSupplier}} similar to 
the way we check available disk space. 



> Re-introduce a blocker for compaction based on available heap
> -------------------------------------------------------------
>
>                 Key: OAK-4966
>                 URL: https://issues.apache.org/jira/browse/OAK-4966
>             Project: Jackrabbit Oak
>          Issue Type: Improvement
>          Components: segment-tar
>            Reporter: Alex Parvulescu
>            Assignee: Alex Parvulescu
>             Fix For: 1.6, 1.5.13
>
>         Attachments: OAK-4966.patch
>
>
> As seen in a local test, running compaction on a tight heap can lead to 
> OOMEs. There used to be a best effort barrier against this situation 'not 
> enough heap for compaction', but we removed it with the compaction maps.
> I think it makes sense to add it again based on the max size of some of the 
> caches: segment cache {{256MB}} by default [0] and some writer caches which 
> can go up to {{2GB}} all combined [1] and probably others I missed.
> [0] 
> https://github.com/apache/jackrabbit-oak/blob/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentCache.java#L48
> [1] 
> https://github.com/apache/jackrabbit-oak/blob/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/WriterCacheManager.java#L50



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to