[prev in list] [next in list] [prev in thread] [next in thread] 

List:       avro-dev
Subject:    [jira] [Created] (AVRO-1818) Avoid buffer copy in DeflateCodec.compress and decompress
From:       "Rohini Palaniswamy (JIRA)" <jira () apache ! org>
Date:       2016-03-31 21:39:25
Message-ID: JIRA.12955103.1459460354000.105813.1459460365614 () Atlassian ! JIRA
[Download RAW message or body]

Rohini Palaniswamy created AVRO-1818:
----------------------------------------

             Summary: Avoid buffer copy in DeflateCodec.compress and decompress
                 Key: AVRO-1818
                 URL: https://issues.apache.org/jira/browse/AVRO-1818
             Project: Avro
          Issue Type: Improvement
            Reporter: Rohini Palaniswamy


One of our jobs reading avro hit OOM due to the buffer copy in compress and \
decompress methods which is very inefficient. 

https://github.com/apache/avro/blob/master/lang/java/avro/src/main/java/org/apache/avro/file/DeflateCodec.java#L71-L86


{code}
java.lang.OutOfMemoryError: Java heap space
	at java.util.Arrays.copyOf(Arrays.java:3236)
	at java.io.ByteArrayOutputStream.toByteArray(ByteArrayOutputStream.java:191)
	at org.apache.avro.file.DeflateCodec.decompress(DeflateCodec.java:84)
{code}



I would suggest using a class that extends ByteArrrayOutputStream like \
https://github.com/apache/hadoop/blob/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/DataOutputBuffer.java#L51-L53


and do
ByteBuffer result = ByteBuffer.wrap(buf.getData(), 0, buf.getLength());



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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic