You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Michael Stack (Jira)" <ji...@apache.org> on 2020/08/21 16:34:00 UTC

[jira] [Assigned] (HBASE-24915) Improve BlockCache read performance by specifying BlockType

     [ https://issues.apache.org/jira/browse/HBASE-24915?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Stack reassigned HBASE-24915:
-------------------------------------

    Assignee: fanrui

> Improve BlockCache read performance by specifying BlockType
> -----------------------------------------------------------
>
>                 Key: HBASE-24915
>                 URL: https://issues.apache.org/jira/browse/HBASE-24915
>             Project: HBase
>          Issue Type: Improvement
>          Components: BlockCache, Performance
>            Reporter: fanrui
>            Assignee: fanrui
>            Priority: Major
>
> CombinedBlockCache contains l1Cache and l2Cache. l1Cache stores MetaBlock and l2Cache stores DataBlock. Because getBlock does not know the BlockType, the getBlock of CombinedBlockCache queries l1Cache first, and then l2Cache. But actually querying DataBlock is not necessary to query l1Cache. 
> Therefore, in some cases where BlockType is known, BlockCache read performance can be improved.
> h2.  Codeļ¼š
>  BlockCache: default call old getBlock
> {code:java}
> default Cacheable getBlock(BlockCacheKey cacheKey, boolean caching, boolean repeat,
>     boolean updateCacheMetrics, BlockType blockType) {
>   return getBlock(cacheKey, caching, repeat, updateCacheMetrics);
> }
> {code}
> CombinedBlockCache:
> {code:java}
> @Override
> public Cacheable getBlock(BlockCacheKey cacheKey, boolean caching, boolean repeat,
>     boolean updateCacheMetrics, BlockType blockType) {
>   if (blockType == null) {
>     return getBlock(cacheKey, caching, repeat, updateCacheMetrics);
>   }
>   boolean metaBlock = isMetaBlock(blockType);
>   if (metaBlock) {
>     return l1Cache.getBlock(cacheKey, caching, repeat, updateCacheMetrics);
>   } else {
>     return l2Cache.getBlock(cacheKey, caching, repeat, updateCacheMetrics);
>   }
> }private boolean isMetaBlock(BlockType blockType) {
>   return blockType.getCategory() != BlockCategory.DATA;
> }
> {code}
> HFileReaderImpl#getCachedBlock call BlockCache#getBlock(XXX, expectedBlockType)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)