You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hbase.apache.org by "BELUGA BEHR (JIRA)" <ji...@apache.org> on 2018/01/02 00:02:00 UTC
[jira] [Created] (HBASE-19684) BlockCacheKey toString Performance
BELUGA BEHR created HBASE-19684:
-----------------------------------
Summary: BlockCacheKey toString Performance
Key: HBASE-19684
URL: https://issues.apache.org/jira/browse/HBASE-19684
Project: HBase
Issue Type: Improvement
Components: hbase
Affects Versions: 3.0.0
Reporter: BELUGA BEHR
Priority: Trivial
{code:titile=BlockCacheKey.java}
@Override
public String toString() {
return String.format("%s_%d", hfileName, offset);
}
{code}
I found through bench-marking that the following code is 10x faster.
{code:titi\le=BlockCacheKey.java}
@Override
public String toString() {
return hfileName.concat("_").concat(Long.toString(offset));
}
{code}
Normally it wouldn't matter for a _toString()_ method, but this is comes into play because {{MemcachedBlockCache}} uses it.
{code:title=MemcachedBlockCache.java}
@Override
public void cacheBlock(BlockCacheKey cacheKey, Cacheable buf) {
if (buf instanceof HFileBlock) {
client.add(cacheKey.toString(), MAX_SIZE, (HFileBlock) buf, tc);
} else {
if (LOG.isDebugEnabled()) {
LOG.debug("MemcachedBlockCache can not cache Cacheable's of type "
+ buf.getClass().toString());
}
}
}
{code}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)