accumulo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Fuchs (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (ACCUMULO-4626) improve cache hit rate via weak reference map
Date Thu, 20 Apr 2017 02:04:04 GMT

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

Adam Fuchs commented on ACCUMULO-4626:
--------------------------------------

The LRUBlockCache has three sections: 25% for "single" blocks, 50% for "multi" blocks, and
25% for "memory" blocks. We don't use the "memory" section, so that comes off the top. The
"multi" section is there to guard against a table scan evicting everything from cache. This
caching algorithm is not bad, but doesn't really take into account the mix of behaviors we
have in typical Accumulo applications (like accessing the same block from multiple deep-copied
iterators). I'd say we can very likely do better if we want to do a fair bit of analysis.

When putting together the patch for this, I noticed we also have another cache option in 2.0
-- the TinyLFA cache (ACCUMULO-4177). That's new to me, so I haven't done any analysis about
how well it optimizes hit rates.

I'm not sure I would advise pulling up the code unless your looking for more gray hair. :-)

> improve cache hit rate via weak reference map
> ---------------------------------------------
>
>                 Key: ACCUMULO-4626
>                 URL: https://issues.apache.org/jira/browse/ACCUMULO-4626
>             Project: Accumulo
>          Issue Type: Improvement
>          Components: tserver
>            Reporter: Adam Fuchs
>              Labels: performance, stability
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> When a single iterator tree references the same RFile blocks in different branches we
sometimes get cache misses for one iterator even though the requested block is held in memory
by another iterator. This is particularly important when using something like the IntersectingIterator
to intersect many deep copies. Instead of evicting completely, keeping evicted blocks into
a WeakReference value map can avoid re-reading blocks that are currently referenced by another
deep copied source iterator.
> We've seen this in the field for some of Sqrrl's queries against very large tablets.
The total memory usage for these queries can be equal to the size of all the iterator block
reads times the number of readahead threads times the number of files times the number of
IntersectingIterator children when cache miss rates are high. This might work out to something
like:
> {code}
> 16 readahead threads * 200 deep copied children * 99% cache miss rate * 20 files * 252KB
per reader = ~16GB of memory
> {code}
> In most cases, evicting to a weak reference value map changes the cache miss rate from
very high to very low and has a dramatic effect on total memory usage.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message