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

Michael Dürig edited comment on OAK-6915 at 11/10/17 2:33 PM:
--------------------------------------------------------------

5th version of the patch: [^OAK-6915-05.patch]. This is essentially the same as 
the 4th, just that I moved the call to {{SegmentId.loaded()}} inside the loader 
closure in {{SegmentCache.getSegment()}}. This doesn't change anything in 
behaviour but I think it does rely less on the implementation details of the 
cache and gives us stronger guarantees re. the eviction call actually happening 
*after* we call loaded.

Additionally I moved updating the current cache weight statistics in 
{{SegmentCache#putSegment()}} before the call to {{Cache.put()}}. This ensures 
we always increment this number before we decrement it, even when 
{{Cache.put()}} results in immediate eviction. 

Finally I left a comment regarding the importance of properly ordering these 
statements in {{SegmentCache.putSegment()}}. [~frm], [~dulceanu], can you 
double check and fix the wording if necessary. The goal would be that we would 
still understand what this is about in two years from now. 


was (Author: mduerig):
5 the version of the patch: [^OAK-6915-05.patch]. This is essentially the same 
as the 4th, just that I moved the call to {{SegmentId.loaded()}} inside the 
loader closure in {{SegmentCache.getSegment()}}. This doesn't change anything 
in behaviour but I think it does rely less on the implementation details of the 
cache and gives us stronger guarantees re. the eviction call actually happening 
*after* we call loaded.

Additionally I moved updating the current cache weight statistics in 
{{SegmentCache#putSegment()}} before the call to {{Cache.put()}}. This ensures 
we always increment this number before we decrement it, even when 
{{Cache.put()}} results in immediate eviction. 

Finally I left a comment regarding the importance of properly ordering these 
statements in {{SegmentCache.putSegment()}}. [~frm], [~dulceanu], can you 
double check and fix the wording if necessary. The goal would be that we would 
still understand what this is about in two years from now. 

> Minimize the amount of uncached segment reads
> ---------------------------------------------
>
>                 Key: OAK-6915
>                 URL: https://issues.apache.org/jira/browse/OAK-6915
>             Project: Jackrabbit Oak
>          Issue Type: Improvement
>          Components: segment-tar
>            Reporter: Francesco Mari
>            Assignee: Francesco Mari
>             Fix For: 1.8, 1.7.12
>
>         Attachments: OAK-6915-01.patch, OAK-6915-02.patch, OAK-6915-03.patch, 
> OAK-6915-04.patch, OAK-6915-05.patch, OAK-6915-diagnostics-02.patch, 
> OAK-6915-diagnostics.patch, OAK-6915.patch, Screen Shot 2017-11-09 at 
> 14.14.28.png, Screen Shot 2017-11-09 at 14.16.59.png
>
>
> The current implementation of {{SegmentCache}} should make better use of the 
> underlying Guava cache by relying on the cached segments instead of 
> unconditionally performing an uncached segment read via the 
> {{Callable<Segment>}} passed to {{SegmentCache#getSegment}}.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to