Return-Path: X-Original-To: apmail-hbase-issues-archive@www.apache.org Delivered-To: apmail-hbase-issues-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B22A7D0A2 for ; Thu, 18 Oct 2012 04:14:05 +0000 (UTC) Received: (qmail 58412 invoked by uid 500); 18 Oct 2012 04:14:05 -0000 Delivered-To: apmail-hbase-issues-archive@hbase.apache.org Received: (qmail 58083 invoked by uid 500); 18 Oct 2012 04:14:03 -0000 Mailing-List: contact issues-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@hbase.apache.org Received: (qmail 58041 invoked by uid 99); 18 Oct 2012 04:14:03 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Oct 2012 04:14:03 +0000 Date: Thu, 18 Oct 2012 04:14:03 +0000 (UTC) From: "binlijin (JIRA)" To: issues@hbase.apache.org Message-ID: <5817103.62023.1350533643153.JavaMail.jiratomcat@arcas> In-Reply-To: <176853832.52767.1336699308498.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (HBASE-5987) HFileBlockIndex improvement MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HBASE-5987?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13478643#comment-13478643 ] binlijin commented on HBASE-5987: --------------------------------- @Lars Hofhansl: Thank you very much. > HFileBlockIndex improvement > --------------------------- > > Key: HBASE-5987 > URL: https://issues.apache.org/jira/browse/HBASE-5987 > Project: HBase > Issue Type: Improvement > Reporter: Liyin Tang > Assignee: Liyin Tang > Fix For: 0.96.0 > > Attachments: ASF.LICENSE.NOT.GRANTED--D3237.1.patch, ASF.LICENSE.NOT.GRANTED--D3237.2.patch, ASF.LICENSE.NOT.GRANTED--D3237.3.patch, ASF.LICENSE.NOT.GRANTED--D3237.4.patch, ASF.LICENSE.NOT.GRANTED--D3237.5.patch, ASF.LICENSE.NOT.GRANTED--D3237.6.patch, ASF.LICENSE.NOT.GRANTED--D3237.7.patch, ASF.LICENSE.NOT.GRANTED--D3237.8.patch, screen_shot_of_sequential_scan_profiling.png > > > Recently we find out a performance problem that it is quite slow when multiple requests are reading the same block of data or index. > From the profiling, one of the causes is the IdLock contention which has been addressed in HBASE-5898. > Another issue is that the HFileScanner will keep asking the HFileBlockIndex about the data block location for each target key value during the scan process(reSeekTo), even though the target key value has already been in the current data block. This issue will cause certain index block very HOT, especially when it is a sequential scan. > To solve this issue, we propose the following solutions: > First, we propose to lookahead for one more block index so that the HFileScanner would know the start key value of next data block. So if the target key value for the scan(reSeekTo) is "smaller" than that start kv of next data block, it means the target key value has a very high possibility in the current data block (if not in current data block, then the start kv of next data block should be returned. +Indexing on the start key has some defects here+) and it shall NOT query the HFileBlockIndex in this case. On the contrary, if the target key value is "bigger", then it shall query the HFileBlockIndex. This improvement shall help to reduce the hotness of HFileBlockIndex and avoid some unnecessary IdLock Contention or Index Block Cache lookup. > Secondary, we propose to push this idea a little further that the HFileBlockIndex shall index on the last key value of each data block instead of indexing on the start key value. The motivation is to solve the HBASE-4443 issue (avoid seeking to "previous" block when key you are interested in is the first one of a block) as well as +the defects mentioned above+. > For example, if the target key value is "smaller" than the start key value of the data block N. There is no way for sure the target key value is in the data block N or N-1. So it has to seek from data block N-1. However, if the block index is based on the last key value for each data block and the target key value is beween the last key value of data block N-1 and data block N, then the target key value is supposed be data block N for sure. > As long as HBase only supports the forward scan, the last key value makes more sense to be indexed on than the start key value. > Thanks Kannan and Mikhail for the insightful discussions and suggestions. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira