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 524AF18376 for ; Thu, 28 Jan 2016 04:31:41 +0000 (UTC) Received: (qmail 53623 invoked by uid 500); 28 Jan 2016 04:31:41 -0000 Delivered-To: apmail-hbase-issues-archive@hbase.apache.org Received: (qmail 53121 invoked by uid 500); 28 Jan 2016 04:31:40 -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 52863 invoked by uid 99); 28 Jan 2016 04:31:40 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Jan 2016 04:31:40 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id E7F042C1F68 for ; Thu, 28 Jan 2016 04:31:39 +0000 (UTC) Date: Thu, 28 Jan 2016 04:31:39 +0000 (UTC) From: "Ted Yu (JIRA)" To: issues@hbase.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HBASE-15180) Reduce garbage created while reading Cells from Codec Decoder 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-15180?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15120736#comment-15120736 ] Ted Yu commented on HBASE-15180: -------------------------------- {code} 48 public Cell readCell(boolean withTags) throws IOException { 49 if (intBuf == null) { 50 // Lazy init. In real flow, we will use the readCell(int, boolean) API only 51 intBuf = new byte[Bytes.SIZEOF_INT]; {code} There are two places where readCell() is implemented in the same manner. Can code duplication be reduced ? {code} 56 protected static class CellReadablePBIS extends PBIS implements CellReadable { {code} What does PB mean above ? > Reduce garbage created while reading Cells from Codec Decoder > ------------------------------------------------------------- > > Key: HBASE-15180 > URL: https://issues.apache.org/jira/browse/HBASE-15180 > Project: HBase > Issue Type: Sub-task > Components: regionserver > Reporter: Anoop Sam John > Assignee: Anoop Sam John > Fix For: 2.0.0 > > Attachments: HBASE-15180.patch > > > In KeyValueDecoder#parseCell (Default Codec decoder) we use KeyValueUtil#iscreate to read cells from the InputStream. Here we 1st create a byte[] of length 4 and read the cell length and then an array of Cell's length and read in cell bytes into it and create a KV. > Actually in server we read the reqs into a byte[] and CellScanner is created on top of a ByteArrayInputStream on top of this. By default in write path, we have MSLAB usage ON. So while adding Cells to memstore, we will copy the Cell bytes to MSLAB memory chunks (default 2 MB size) and recreate Cells over that bytes. So there is no issue if we create Cells over the RPC read byte[] directly here in Decoder. No need for 2 byte[] creation and copy for every Cell in request. > My plan is to make a Cell aware ByteArrayInputStream which can read Cells directly from it. > Same Codec path is used in client side also. There better we can avoid this direct Cell create and continue to do the copy to smaller byte[]s path. Plan to introduce some thing like a CodecContext associated with every Codec instance which can say the server/client context. -- This message was sent by Atlassian JIRA (v6.3.4#6332)