Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id A3518200B99 for ; Wed, 5 Oct 2016 17:29:22 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 9EADB160AC9; Wed, 5 Oct 2016 15:29:22 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id DA936160AEA for ; Wed, 5 Oct 2016 17:29:21 +0200 (CEST) Received: (qmail 72766 invoked by uid 500); 5 Oct 2016 15:29:20 -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 72716 invoked by uid 99); 5 Oct 2016 15:29:20 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Oct 2016 15:29:20 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 906B92C2A65 for ; Wed, 5 Oct 2016 15:29:20 +0000 (UTC) Date: Wed, 5 Oct 2016 15:29:20 +0000 (UTC) From: "stack (JIRA)" To: issues@hbase.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HBASE-15721) Optimization in cloning cells into MSLAB MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 05 Oct 2016 15:29:22 -0000 [ https://issues.apache.org/jira/browse/HBASE-15721?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15549067#comment-15549067 ] stack commented on HBASE-15721: ------------------------------- This sort of stuff is odd... how we intend to address it going forward? offset = KeyValueUtil.appendToByteArray(this.cell, buf, offset, false); We are doing the above in the class named CellUtil. This stuff is fine but when do we move away from depending on the keyvalue being serialized in the old KeyValue way? When we going to do a Cell w/ a new layout! (smile). For example, we remove this deprecation which seems to be a regression: 243 * @deprecated Since 0.98.0. Use Cell Interface instead. Do not presume single backing buffer. 1244 */ 1243 */ 1245 @Deprecated public byte [] getBuffer() { +1 on this patch as is. > Optimization in cloning cells into MSLAB > ---------------------------------------- > > Key: HBASE-15721 > URL: https://issues.apache.org/jira/browse/HBASE-15721 > Project: HBase > Issue Type: Sub-task > Components: regionserver > Reporter: Anoop Sam John > Assignee: Anoop Sam John > Fix For: 2.0.0 > > Attachments: HBASE-15721.patch, HBASE-15721_V2.patch, HBASE-15721_V3.patch, HBASE-15721_V4.patch > > > Before cells added to memstore CSLM, there is a clone of cell after copying it to MSLAB chunk area. This is done not in an efficient way. > {code} > public static int appendToByteArray(final Cell cell, final byte[] output, final int offset) { > int pos = offset; > pos = Bytes.putInt(output, pos, keyLength(cell)); > pos = Bytes.putInt(output, pos, cell.getValueLength()); > pos = appendKeyTo(cell, output, pos); > pos = CellUtil.copyValueTo(cell, output, pos); > if ((cell.getTagsLength() > 0)) { > pos = Bytes.putAsShort(output, pos, cell.getTagsLength()); > pos = CellUtil.copyTagTo(cell, output, pos); > } > return pos; > } > {code} > Copied in 9 steps and we end up parsing all lengths. When the cell implementation is backed by a single byte[] (Like KeyValue) this can be done in single step copy. > Also avoid lots of garbage while doing this MSLAB copy. With every cell, we used to create a ByteRange instance to pass the allocated chunk + offset from MSLAB to Segment. Now we can make the MSLAB impl to do the allocation and copy of the cell so that one object creation per cell addition can be avoided. -- This message was sent by Atlassian JIRA (v6.3.4#6332)