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 A0C0B9E1F for ; Tue, 22 May 2012 07:30:44 +0000 (UTC) Received: (qmail 61509 invoked by uid 500); 22 May 2012 07:30:43 -0000 Delivered-To: apmail-hbase-issues-archive@hbase.apache.org Received: (qmail 61111 invoked by uid 500); 22 May 2012 07:30:42 -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 61073 invoked by uid 99); 22 May 2012 07:30:41 -0000 Received: from issues-vm.apache.org (HELO issues-vm) (140.211.11.160) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 May 2012 07:30:41 +0000 Received: from isssues-vm.apache.org (localhost [127.0.0.1]) by issues-vm (Postfix) with ESMTP id 6794114280B for ; Tue, 22 May 2012 07:30:41 +0000 (UTC) Date: Tue, 22 May 2012 07:30:41 +0000 (UTC) From: "Todd Lipcon (JIRA)" To: issues@hbase.apache.org Message-ID: <1524034734.6916.1337671841428.JavaMail.jiratomcat@issues-vm> In-Reply-To: <1635581271.6759.1337668303096.JavaMail.jiratomcat@issues-vm> Subject: [jira] [Assigned] (HBASE-6066) some low hanging read path improvement ideas 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-6066?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Todd Lipcon reassigned HBASE-6066: ---------------------------------- Assignee: Todd Lipcon > some low hanging read path improvement ideas > --------------------------------------------- > > Key: HBASE-6066 > URL: https://issues.apache.org/jira/browse/HBASE-6066 > Project: HBase > Issue Type: Improvement > Reporter: Kannan Muthukkaruppan > Assignee: Todd Lipcon > Priority: Minor > > I was running some single threaded scan performance tests for a table with small sized rows that is fully cached. Some observations... > We seem to be doing several wasteful iterations over and/or building of temporary lists. > 1) One such is the following code in HRegionServer.next(): > {code} > boolean moreRows = s.next(values, HRegion.METRIC_NEXTSIZE); > if (!values.isEmpty()) { > for (KeyValue kv : values) { ------> #### wasteful in most cases > currentScanResultSize += kv.heapSize(); > } > results.add(new Result(values)); > {code} > By default the "maxScannerResultSize" is Long.MAX_VALUE. In those cases, > we can avoid the unnecessary iteration to compute currentScanResultSize. > 2) An example of a wasteful temporary array, is "results" in > RegionScanner.next(). > {code} > results.clear(); > boolean returnResult = nextInternal(limit, metric); > outResults.addAll(results); > {code} > results then gets copied over to outResults via an addAll(). Not sure why we can not directly collect the results in outResults. > 3) Another almost similar exmaple of a wasteful array is "results" in StoreScanner.next(), which eventually also copies its results into "outResults". > 4) Reduce overhead of "size metric" maintained in StoreScanner.next(). > {code} > if (metric != null) { > HRegion.incrNumericMetric(this.metricNamePrefix + metric, > copyKv.getLength()); > } > results.add(copyKv); > {code} > A single call to next() might fetch a lot of KVs. We can first add up the size of those KVs in a local variable and then in a finally clause increment the metric one shot, rather than updating AtomicLongs for each KV. > 5) RegionScanner.next() calls a helper RegionScanner.next() on the same object. Both are synchronized methods. Synchronized methods calling nested synchronized methods on the same object are probably adding some small overhead. The inner next() calls isFilterDone() which is a also a synchronized method. We should factor the code to avoid these nested synchronized methods. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira