[ 
https://issues.apache.org/jira/browse/HBASE-15721?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15266153#comment-15266153
 ] 

Anoop Sam John commented on HBASE-15721:
----------------------------------------

MemStoreLAB says
{quote}
Without the MSLAB, the byte array allocated during insertion end up interleaved 
throughout the
 * heap, and the old generation gets progressively more fragmented until a 
stop-the-world compacting
 * collection occurs.
{quote}
So instead of allocating a chunk from interface and copy and recreate Cell in 
memstore class, we can allocate and  clone within the MSLAB impl. May be we 
need change the comments on class.
Ah I missed reading the javadocs in Streamble..  Ya agree bit odd to add a 
write method into byte[].  So the best way will be to have a Writable 
interface?  What do u say?  It will help if we can write in one shot rather 
than individual components

getBuffer() can be returned by any KeyValue.  Not Cell..  Ya KeyValue we say it 
is backed by single byte[].  So I thought it is just fine. We deprecated it 
when the read and write flow had KeyValue as passed type (in some places) 
rather than Cell..  Now we have Cell every where.  And Cell dont have 
getBuffer()..  I thought it is just fine.

> 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
>
>
> 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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to