You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@avro.apache.org by Ruslan Al-Fakikh <me...@gmail.com> on 2012/07/04 15:32:56 UTC
Avro file size is too big
Hello,
In my organization currently we are evaluating Avro as a format. Our
concern is file size. I've done some comparisons of a piece of our
data.
Say we have sequence files, compressed. The payload (values) are just
lines. As far as I know we use line number as keys and we use the
default codec for compression inside sequence files. The size is 1.6G,
when I put it to avro with deflate codec with deflate level 9 it
becomes 2.2G.
This is interesting, because the values in seq files are just string,
but Avro has a normal schema with primitive types. And those are kept
binary. Shouldn't Avro be less in size?
Also I took another dataset which is 28G (gzip files, plain
tab-delimited text, don't know what is the deflate level) and put it
to Avro and it became 38G
Why Avro is so big in size? Am I missing some size optimization?
Thanks in advance!
Re: Avro file size is too big
Posted by Ruslan Al-Fakikh <me...@gmail.com>.
Hi Russell,
I am not aware what flushing is. I am creating Avro files from Pig and
from Hive (and having basically the same results).
I've already saw that post, but my question differs. That guy had
40G of raw text, then after he RESOLVED his problem he got 4.5G of
Avro with deflate codec. So now he has 8.8X compression.
My results are even better from the beginning.
I have 27G of raw text, then I have 2.2G of Avro with deflate codec
(deflate level 9), so my compression is 12X
But my question is why gzip files and sequence files (with the default
codec) are 0.72 smaller than Avro files with deflate level 9?
Thanks
On Thu, Jul 5, 2012 at 1:58 AM, Russell Jurney <ru...@gmail.com> wrote:
> This thread looks useful. Are you flushing too often?
> http://apache-avro.679487.n3.nabble.com/avro-compression-using-snappy-and-deflate-td3870167.html
>
> Russell Jurney http://datasyndrome.com
>
> On Jul 4, 2012, at 6:33 AM, Ruslan Al-Fakikh <me...@gmail.com> wrote:
>
>> Hello,
>>
>> In my organization currently we are evaluating Avro as a format. Our
>> concern is file size. I've done some comparisons of a piece of our
>> data.
>> Say we have sequence files, compressed. The payload (values) are just
>> lines. As far as I know we use line number as keys and we use the
>> default codec for compression inside sequence files. The size is 1.6G,
>> when I put it to avro with deflate codec with deflate level 9 it
>> becomes 2.2G.
>> This is interesting, because the values in seq files are just string,
>> but Avro has a normal schema with primitive types. And those are kept
>> binary. Shouldn't Avro be less in size?
>> Also I took another dataset which is 28G (gzip files, plain
>> tab-delimited text, don't know what is the deflate level) and put it
>> to Avro and it became 38G
>> Why Avro is so big in size? Am I missing some size optimization?
>>
>> Thanks in advance!
Re: Avro file size is too big
Posted by Russell Jurney <ru...@gmail.com>.
This thread looks useful. Are you flushing too often?
http://apache-avro.679487.n3.nabble.com/avro-compression-using-snappy-and-deflate-td3870167.html
Russell Jurney http://datasyndrome.com
On Jul 4, 2012, at 6:33 AM, Ruslan Al-Fakikh <me...@gmail.com> wrote:
> Hello,
>
> In my organization currently we are evaluating Avro as a format. Our
> concern is file size. I've done some comparisons of a piece of our
> data.
> Say we have sequence files, compressed. The payload (values) are just
> lines. As far as I know we use line number as keys and we use the
> default codec for compression inside sequence files. The size is 1.6G,
> when I put it to avro with deflate codec with deflate level 9 it
> becomes 2.2G.
> This is interesting, because the values in seq files are just string,
> but Avro has a normal schema with primitive types. And those are kept
> binary. Shouldn't Avro be less in size?
> Also I took another dataset which is 28G (gzip files, plain
> tab-delimited text, don't know what is the deflate level) and put it
> to Avro and it became 38G
> Why Avro is so big in size? Am I missing some size optimization?
>
> Thanks in advance!
Re: Avro file size is too big
Posted by Ey-Chih chow <ey...@gmail.com>.
Thanks Doug.
As I mentioned before, we actually tried the level option and set it to 9. But it does not make any difference on the size of the compressed file by setting or not setting the option.
Ey-Chih Chow
On Jul 20, 2012, at 1:00 PM, Doug Cutting wrote:
> On Fri, Jul 20, 2012 at 10:12 AM, Ey-Chih chow <ey...@gmail.com> wrote:
>> We use the avro tool, fromtext, to compress a json log file. I didn't find an option that can set the sync interval.
>
> The fromtext tool has a --level option, e.g.:
>
> java -jar avro-tools.jar --level 9 foo.txt foo.avro
>
> Doug
Re: Avro file size is too big
Posted by Doug Cutting <cu...@apache.org>.
On Fri, Jul 20, 2012 at 10:12 AM, Ey-Chih chow <ey...@gmail.com> wrote:
> We use the avro tool, fromtext, to compress a json log file. I didn't find an option that can set the sync interval.
The fromtext tool has a --level option, e.g.:
java -jar avro-tools.jar --level 9 foo.txt foo.avro
Doug
Re: Avro file size is too big
Posted by Ey-Chih chow <ey...@gmail.com>.
We use the avro tool, fromtext, to compress a json log file. I didn't find an option that can set the sync interval.
Ey-Chih Chow
On Jul 20, 2012, at 10:02 AM, Ey-Chih chow wrote:
> I changed to use the maximal compression level, i.e. 9, but the size is the same.
>
> Ey-Chih Chow
>
> On Jul 19, 2012, at 7:07 PM, Harsh J wrote:
>
>> Snappy is known to have lower compression rates against Gzip, but
>> perhaps you can try larger blocks in the Avro DataFiles as indicated
>> in the thread, via a higher sync-interval? [1] What snappy is really
>> good at is a fast decompression rate though, so perhaps your reads are
>> going to be comparable with gzip plaintext?
>>
>> P.s. What do you get if you use deflate compression on the data files,
>> with maximal compression level (9)? [2]
>>
>> [1] - http://avro.apache.org/docs/1.7.1/api/java/org/apache/avro/mapred/AvroOutputFormat.html#setSyncInterval(org.apache.hadoop.mapred.JobConf,%20int)
>> or http://avro.apache.org/docs/1.7.1/api/java/index.html?org/apache/avro/mapred/AvroOutputFormat.html
>>
>> [2] - http://avro.apache.org/docs/1.7.1/api/java/org/apache/avro/mapred/AvroOutputFormat.html#setDeflateLevel(org.apache.hadoop.mapred.JobConf,%20int)
>> or via http://avro.apache.org/docs/1.7.1/api/java/org/apache/avro/file/CodecFactory.html#deflateCodec(int)
>> coupled with http://avro.apache.org/docs/1.7.1/api/java/org/apache/avro/file/DataFileWriter.html#setCodec(org.apache.avro.file.CodecFactory)
>>
>> On Thu, Jul 19, 2012 at 5:29 AM, Ey-Chih chow <ey...@gmail.com> wrote:
>>> We are converting our compression scheme from gzip to snappy for our json logs. In one case, the size of a gzip file is 715MB and the corresponding snappy file is 1.885GB. The schema of the snappy file is "bytes". In other words, we compress line by line of our json logs and each line is a json string. Is there any way we can optimize our compression with snappy?
>>>
>>> Ey-Chih Chow
>>>
>>>
>>> On Jul 5, 2012, at 3:19 PM, Doug Cutting wrote:
>>>
>>>> You can use the Avro command-line tool to dump the metadata, which
>>>> will show the schema and codec:
>>>>
>>>> java -jar avro-tools.jar getmeta <file>
>>>>
>>>> Doug
>>>>
>>>> On Thu, Jul 5, 2012 at 3:11 PM, Ruslan Al-Fakikh <me...@gmail.com> wrote:
>>>>> Hey Doug,
>>>>>
>>>>> Here is a little more of explanation
>>>>> http://mail-archives.apache.org/mod_mbox/avro-user/201207.mbox/%3CCACBYqwQWPaj8NaGVTOir4dO%2BOqri-UM-8RQ-5Uu2r2bLCyuBTA%40mail.gmail.com%3E
>>>>> I'll answer your questions later after some investigation
>>>>>
>>>>> Thank you!
>>>>>
>>>>>
>>>>> On Thu, Jul 5, 2012 at 9:24 PM, Doug Cutting <cu...@apache.org> wrote:
>>>>>> Rusian,
>>>>>>
>>>>>> This is unexpected. Perhaps we can understand it if we have more information.
>>>>>>
>>>>>> What Writable class are you using for keys and values in the SequenceFile?
>>>>>>
>>>>>> What schema are you using in the Avro data file?
>>>>>>
>>>>>> Can you provide small sample files of each and/or code that will reproduce this?
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> Doug
>>>>>>
>>>>>> On Wed, Jul 4, 2012 at 6:32 AM, Ruslan Al-Fakikh <me...@gmail.com> wrote:
>>>>>>> Hello,
>>>>>>>
>>>>>>> In my organization currently we are evaluating Avro as a format. Our
>>>>>>> concern is file size. I've done some comparisons of a piece of our
>>>>>>> data.
>>>>>>> Say we have sequence files, compressed. The payload (values) are just
>>>>>>> lines. As far as I know we use line number as keys and we use the
>>>>>>> default codec for compression inside sequence files. The size is 1.6G,
>>>>>>> when I put it to avro with deflate codec with deflate level 9 it
>>>>>>> becomes 2.2G.
>>>>>>> This is interesting, because the values in seq files are just string,
>>>>>>> but Avro has a normal schema with primitive types. And those are kept
>>>>>>> binary. Shouldn't Avro be less in size?
>>>>>>> Also I took another dataset which is 28G (gzip files, plain
>>>>>>> tab-delimited text, don't know what is the deflate level) and put it
>>>>>>> to Avro and it became 38G
>>>>>>> Why Avro is so big in size? Am I missing some size optimization?
>>>>>>>
>>>>>>> Thanks in advance!
>>>
>>
>>
>>
>> --
>> Harsh J
>
Re: Avro file size is too big
Posted by Ey-Chih chow <ey...@gmail.com>.
I changed to use the maximal compression level, i.e. 9, but the size is the same.
Ey-Chih Chow
On Jul 19, 2012, at 7:07 PM, Harsh J wrote:
> Snappy is known to have lower compression rates against Gzip, but
> perhaps you can try larger blocks in the Avro DataFiles as indicated
> in the thread, via a higher sync-interval? [1] What snappy is really
> good at is a fast decompression rate though, so perhaps your reads are
> going to be comparable with gzip plaintext?
>
> P.s. What do you get if you use deflate compression on the data files,
> with maximal compression level (9)? [2]
>
> [1] - http://avro.apache.org/docs/1.7.1/api/java/org/apache/avro/mapred/AvroOutputFormat.html#setSyncInterval(org.apache.hadoop.mapred.JobConf,%20int)
> or http://avro.apache.org/docs/1.7.1/api/java/index.html?org/apache/avro/mapred/AvroOutputFormat.html
>
> [2] - http://avro.apache.org/docs/1.7.1/api/java/org/apache/avro/mapred/AvroOutputFormat.html#setDeflateLevel(org.apache.hadoop.mapred.JobConf,%20int)
> or via http://avro.apache.org/docs/1.7.1/api/java/org/apache/avro/file/CodecFactory.html#deflateCodec(int)
> coupled with http://avro.apache.org/docs/1.7.1/api/java/org/apache/avro/file/DataFileWriter.html#setCodec(org.apache.avro.file.CodecFactory)
>
> On Thu, Jul 19, 2012 at 5:29 AM, Ey-Chih chow <ey...@gmail.com> wrote:
>> We are converting our compression scheme from gzip to snappy for our json logs. In one case, the size of a gzip file is 715MB and the corresponding snappy file is 1.885GB. The schema of the snappy file is "bytes". In other words, we compress line by line of our json logs and each line is a json string. Is there any way we can optimize our compression with snappy?
>>
>> Ey-Chih Chow
>>
>>
>> On Jul 5, 2012, at 3:19 PM, Doug Cutting wrote:
>>
>>> You can use the Avro command-line tool to dump the metadata, which
>>> will show the schema and codec:
>>>
>>> java -jar avro-tools.jar getmeta <file>
>>>
>>> Doug
>>>
>>> On Thu, Jul 5, 2012 at 3:11 PM, Ruslan Al-Fakikh <me...@gmail.com> wrote:
>>>> Hey Doug,
>>>>
>>>> Here is a little more of explanation
>>>> http://mail-archives.apache.org/mod_mbox/avro-user/201207.mbox/%3CCACBYqwQWPaj8NaGVTOir4dO%2BOqri-UM-8RQ-5Uu2r2bLCyuBTA%40mail.gmail.com%3E
>>>> I'll answer your questions later after some investigation
>>>>
>>>> Thank you!
>>>>
>>>>
>>>> On Thu, Jul 5, 2012 at 9:24 PM, Doug Cutting <cu...@apache.org> wrote:
>>>>> Rusian,
>>>>>
>>>>> This is unexpected. Perhaps we can understand it if we have more information.
>>>>>
>>>>> What Writable class are you using for keys and values in the SequenceFile?
>>>>>
>>>>> What schema are you using in the Avro data file?
>>>>>
>>>>> Can you provide small sample files of each and/or code that will reproduce this?
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Doug
>>>>>
>>>>> On Wed, Jul 4, 2012 at 6:32 AM, Ruslan Al-Fakikh <me...@gmail.com> wrote:
>>>>>> Hello,
>>>>>>
>>>>>> In my organization currently we are evaluating Avro as a format. Our
>>>>>> concern is file size. I've done some comparisons of a piece of our
>>>>>> data.
>>>>>> Say we have sequence files, compressed. The payload (values) are just
>>>>>> lines. As far as I know we use line number as keys and we use the
>>>>>> default codec for compression inside sequence files. The size is 1.6G,
>>>>>> when I put it to avro with deflate codec with deflate level 9 it
>>>>>> becomes 2.2G.
>>>>>> This is interesting, because the values in seq files are just string,
>>>>>> but Avro has a normal schema with primitive types. And those are kept
>>>>>> binary. Shouldn't Avro be less in size?
>>>>>> Also I took another dataset which is 28G (gzip files, plain
>>>>>> tab-delimited text, don't know what is the deflate level) and put it
>>>>>> to Avro and it became 38G
>>>>>> Why Avro is so big in size? Am I missing some size optimization?
>>>>>>
>>>>>> Thanks in advance!
>>
>
>
>
> --
> Harsh J
Re: Avro file size is too big
Posted by Harsh J <ha...@cloudera.com>.
Snappy is known to have lower compression rates against Gzip, but
perhaps you can try larger blocks in the Avro DataFiles as indicated
in the thread, via a higher sync-interval? [1] What snappy is really
good at is a fast decompression rate though, so perhaps your reads are
going to be comparable with gzip plaintext?
P.s. What do you get if you use deflate compression on the data files,
with maximal compression level (9)? [2]
[1] - http://avro.apache.org/docs/1.7.1/api/java/org/apache/avro/mapred/AvroOutputFormat.html#setSyncInterval(org.apache.hadoop.mapred.JobConf,%20int)
or http://avro.apache.org/docs/1.7.1/api/java/index.html?org/apache/avro/mapred/AvroOutputFormat.html
[2] - http://avro.apache.org/docs/1.7.1/api/java/org/apache/avro/mapred/AvroOutputFormat.html#setDeflateLevel(org.apache.hadoop.mapred.JobConf,%20int)
or via http://avro.apache.org/docs/1.7.1/api/java/org/apache/avro/file/CodecFactory.html#deflateCodec(int)
coupled with http://avro.apache.org/docs/1.7.1/api/java/org/apache/avro/file/DataFileWriter.html#setCodec(org.apache.avro.file.CodecFactory)
On Thu, Jul 19, 2012 at 5:29 AM, Ey-Chih chow <ey...@gmail.com> wrote:
> We are converting our compression scheme from gzip to snappy for our json logs. In one case, the size of a gzip file is 715MB and the corresponding snappy file is 1.885GB. The schema of the snappy file is "bytes". In other words, we compress line by line of our json logs and each line is a json string. Is there any way we can optimize our compression with snappy?
>
> Ey-Chih Chow
>
>
> On Jul 5, 2012, at 3:19 PM, Doug Cutting wrote:
>
>> You can use the Avro command-line tool to dump the metadata, which
>> will show the schema and codec:
>>
>> java -jar avro-tools.jar getmeta <file>
>>
>> Doug
>>
>> On Thu, Jul 5, 2012 at 3:11 PM, Ruslan Al-Fakikh <me...@gmail.com> wrote:
>>> Hey Doug,
>>>
>>> Here is a little more of explanation
>>> http://mail-archives.apache.org/mod_mbox/avro-user/201207.mbox/%3CCACBYqwQWPaj8NaGVTOir4dO%2BOqri-UM-8RQ-5Uu2r2bLCyuBTA%40mail.gmail.com%3E
>>> I'll answer your questions later after some investigation
>>>
>>> Thank you!
>>>
>>>
>>> On Thu, Jul 5, 2012 at 9:24 PM, Doug Cutting <cu...@apache.org> wrote:
>>>> Rusian,
>>>>
>>>> This is unexpected. Perhaps we can understand it if we have more information.
>>>>
>>>> What Writable class are you using for keys and values in the SequenceFile?
>>>>
>>>> What schema are you using in the Avro data file?
>>>>
>>>> Can you provide small sample files of each and/or code that will reproduce this?
>>>>
>>>> Thanks,
>>>>
>>>> Doug
>>>>
>>>> On Wed, Jul 4, 2012 at 6:32 AM, Ruslan Al-Fakikh <me...@gmail.com> wrote:
>>>>> Hello,
>>>>>
>>>>> In my organization currently we are evaluating Avro as a format. Our
>>>>> concern is file size. I've done some comparisons of a piece of our
>>>>> data.
>>>>> Say we have sequence files, compressed. The payload (values) are just
>>>>> lines. As far as I know we use line number as keys and we use the
>>>>> default codec for compression inside sequence files. The size is 1.6G,
>>>>> when I put it to avro with deflate codec with deflate level 9 it
>>>>> becomes 2.2G.
>>>>> This is interesting, because the values in seq files are just string,
>>>>> but Avro has a normal schema with primitive types. And those are kept
>>>>> binary. Shouldn't Avro be less in size?
>>>>> Also I took another dataset which is 28G (gzip files, plain
>>>>> tab-delimited text, don't know what is the deflate level) and put it
>>>>> to Avro and it became 38G
>>>>> Why Avro is so big in size? Am I missing some size optimization?
>>>>>
>>>>> Thanks in advance!
>
--
Harsh J
Re: Avro file size is too big
Posted by Ey-Chih chow <ey...@gmail.com>.
We are converting our compression scheme from gzip to snappy for our json logs. In one case, the size of a gzip file is 715MB and the corresponding snappy file is 1.885GB. The schema of the snappy file is "bytes". In other words, we compress line by line of our json logs and each line is a json string. Is there any way we can optimize our compression with snappy?
Ey-Chih Chow
On Jul 5, 2012, at 3:19 PM, Doug Cutting wrote:
> You can use the Avro command-line tool to dump the metadata, which
> will show the schema and codec:
>
> java -jar avro-tools.jar getmeta <file>
>
> Doug
>
> On Thu, Jul 5, 2012 at 3:11 PM, Ruslan Al-Fakikh <me...@gmail.com> wrote:
>> Hey Doug,
>>
>> Here is a little more of explanation
>> http://mail-archives.apache.org/mod_mbox/avro-user/201207.mbox/%3CCACBYqwQWPaj8NaGVTOir4dO%2BOqri-UM-8RQ-5Uu2r2bLCyuBTA%40mail.gmail.com%3E
>> I'll answer your questions later after some investigation
>>
>> Thank you!
>>
>>
>> On Thu, Jul 5, 2012 at 9:24 PM, Doug Cutting <cu...@apache.org> wrote:
>>> Rusian,
>>>
>>> This is unexpected. Perhaps we can understand it if we have more information.
>>>
>>> What Writable class are you using for keys and values in the SequenceFile?
>>>
>>> What schema are you using in the Avro data file?
>>>
>>> Can you provide small sample files of each and/or code that will reproduce this?
>>>
>>> Thanks,
>>>
>>> Doug
>>>
>>> On Wed, Jul 4, 2012 at 6:32 AM, Ruslan Al-Fakikh <me...@gmail.com> wrote:
>>>> Hello,
>>>>
>>>> In my organization currently we are evaluating Avro as a format. Our
>>>> concern is file size. I've done some comparisons of a piece of our
>>>> data.
>>>> Say we have sequence files, compressed. The payload (values) are just
>>>> lines. As far as I know we use line number as keys and we use the
>>>> default codec for compression inside sequence files. The size is 1.6G,
>>>> when I put it to avro with deflate codec with deflate level 9 it
>>>> becomes 2.2G.
>>>> This is interesting, because the values in seq files are just string,
>>>> but Avro has a normal schema with primitive types. And those are kept
>>>> binary. Shouldn't Avro be less in size?
>>>> Also I took another dataset which is 28G (gzip files, plain
>>>> tab-delimited text, don't know what is the deflate level) and put it
>>>> to Avro and it became 38G
>>>> Why Avro is so big in size? Am I missing some size optimization?
>>>>
>>>> Thanks in advance!
Re: Avro file size is too big
Posted by Russell Jurney <ru...@gmail.com>.
Not sure if it's helpful, but python and ruby cat_avro utilities are
linked here: http://hortonworks.com/blog/the-data-lifecycle-part-one-avroizing-the-enron-emails/
These do schema and sample. Should I modify these to get meta information?
Russell Jurney
twitter.com/rjurney
russell.jurney@gmail.com
datasyndrome.com
On Jul 5, 2012, at 3:32 PM, Ruslan Al-Fakikh <me...@gmail.com> wrote:
> Hey
>
> Sorry, couldn't use getmeta, It is in Avro 1.6, I have only 1.5 in my CDH distro
> -bash-3.2$ java -jar avro-tools-1.5.4.jar getschema 000000_0.avro
> {
> "type" : "record",
> "name" : "TUPLE_0",
> "fields" : [ {
> "name" : "EventDateIgnore",
> "type" : [ "null", "string" ],
> "doc" : ""
> }, {
> "name" : "DatranClientIDIgnore",
> "type" : [ "null", "int" ],
> "doc" : ""
> }, {
> "name" : "CreativeID",
> "type" : [ "null", "int" ],
> "doc" : ""
> }, {
> "name" : "AgencyID",
> "type" : [ "null", "int" ],
> "doc" : ""
> }, {
> "name" : "PlacementID",
> "type" : [ "null", "int" ],
> "doc" : ""
> }, {
> "name" : "CookieID",
> "type" : [ "null", "long" ],
> "doc" : ""
> }, {
> "name" : "WebProfileID",
> "type" : [ "null", "long" ],
> "doc" : ""
> }, {
> "name" : "IPAddress",
> "type" : [ "null", "string" ],
> "doc" : ""
> }, {
> "name" : "ZipCode",
> "type" : [ "null", "string" ],
> "doc" : ""
> }, {
> "name" : "DMAID",
> "type" : [ "null", "int" ],
> "doc" : ""
> }, {
> "name" : "Impressions",
> "type" : [ "null", "int" ],
> "doc" : ""
> }, {
> "name" : "Clicks",
> "type" : [ "null", "int" ],
> "doc" : ""
> }, {
> "name" : "PostImpressions",
> "type" : [ "null", "int" ],
> "doc" : ""
> }, {
> "name" : "PostClicks",
> "type" : [ "null", "int" ],
> "doc" : ""
> }, {
> "name" : "ApertureDataID",
> "type" : [ "null", "string" ],
> "doc" : ""
> }, {
> "name" : "ApertureCategoryID",
> "type" : [ "null", "string" ],
> "doc" : ""
> } ]
> }
>
> Also I can see that the file starts with
> Objavro.codecdeflateavro.schema�{"type":"record","name":"TUPLE_0","fields"
>
> Hope that helps.
>
> Thanks
>
> On Fri, Jul 6, 2012 at 2:19 AM, Doug Cutting <cu...@apache.org> wrote:
>> You can use the Avro command-line tool to dump the metadata, which
>> will show the schema and codec:
>>
>> java -jar avro-tools.jar getmeta <file>
>>
>> Doug
>>
>> On Thu, Jul 5, 2012 at 3:11 PM, Ruslan Al-Fakikh <me...@gmail.com> wrote:
>>> Hey Doug,
>>>
>>> Here is a little more of explanation
>>> http://mail-archives.apache.org/mod_mbox/avro-user/201207.mbox/%3CCACBYqwQWPaj8NaGVTOir4dO%2BOqri-UM-8RQ-5Uu2r2bLCyuBTA%40mail.gmail.com%3E
>>> I'll answer your questions later after some investigation
>>>
>>> Thank you!
>>>
>>>
>>> On Thu, Jul 5, 2012 at 9:24 PM, Doug Cutting <cu...@apache.org> wrote:
>>>> Rusian,
>>>>
>>>> This is unexpected. Perhaps we can understand it if we have more information.
>>>>
>>>> What Writable class are you using for keys and values in the SequenceFile?
>>>>
>>>> What schema are you using in the Avro data file?
>>>>
>>>> Can you provide small sample files of each and/or code that will reproduce this?
>>>>
>>>> Thanks,
>>>>
>>>> Doug
>>>>
>>>> On Wed, Jul 4, 2012 at 6:32 AM, Ruslan Al-Fakikh <me...@gmail.com> wrote:
>>>>> Hello,
>>>>>
>>>>> In my organization currently we are evaluating Avro as a format. Our
>>>>> concern is file size. I've done some comparisons of a piece of our
>>>>> data.
>>>>> Say we have sequence files, compressed. The payload (values) are just
>>>>> lines. As far as I know we use line number as keys and we use the
>>>>> default codec for compression inside sequence files. The size is 1.6G,
>>>>> when I put it to avro with deflate codec with deflate level 9 it
>>>>> becomes 2.2G.
>>>>> This is interesting, because the values in seq files are just string,
>>>>> but Avro has a normal schema with primitive types. And those are kept
>>>>> binary. Shouldn't Avro be less in size?
>>>>> Also I took another dataset which is 28G (gzip files, plain
>>>>> tab-delimited text, don't know what is the deflate level) and put it
>>>>> to Avro and it became 38G
>>>>> Why Avro is so big in size? Am I missing some size optimization?
>>>>>
>>>>> Thanks in advance!
Re: Avro file size is too big
Posted by Scott Carey <sc...@apache.org>.
You can use Avro 1.6 or 1.7 to inspect the file, just download the jar
from maven. It is backwards compatible with data files since Avro 1.3.
http://repo1.maven.org/maven2/org/apache/avro/avro-tools/
I often do something like
'curl
http://repo1.maven.org/maven2/org/apache/avro/avro-tools/1.7.0/avro-tools-1
.7.0.jar > avro-tools-1.7.0.jar'
to get the file locally and use the tools jar from there for inspecting
Avro data files.
The schema you have has each field nullable, which adds 1 byte to each
field to encode whether it is null or not. If you are not storing these
as nullable elsewhere that may account for some size difference.
How many records are there? What is the average size per record
uncompressed and compressed? What is the syncInterval on the file (the
target uncompressed block size)?
Additionally, how the data is ordered can have a dramatic effect on
compression size. If you are comparing Avro to another format and the
sort order of items differs, it is not a valid comparison. For example,
if you sort the data by values that have common prefixes or low
cardinality compression will be better than random order.
One of the MapReduce jobs I have orders data for a partition by a few low
cardinality fields and large strings that are neighboring fields in the
schema. This results in 25% less compressed size on my data.
Another thing that can affect compression ratio is the ordering of fields
-- improving the length of common, repeated byte sequences will improve
gzip compression levels so co-locating low cardinality fields or fields
that have high cross-correlation will result in higher compression.
On 7/5/12 3:31 PM, "Ruslan Al-Fakikh" <me...@gmail.com> wrote:
>Hey
>
>Sorry, couldn't use getmeta, It is in Avro 1.6, I have only 1.5 in my CDH
>distro
>-bash-3.2$ java -jar avro-tools-1.5.4.jar getschema 000000_0.avro
>{
> "type" : "record",
> "name" : "TUPLE_0",
> "fields" : [ {
> "name" : "EventDateIgnore",
> "type" : [ "null", "string" ],
> "doc" : ""
> }, {
> "name" : "DatranClientIDIgnore",
> "type" : [ "null", "int" ],
> "doc" : ""
> }, {
> "name" : "CreativeID",
> "type" : [ "null", "int" ],
> "doc" : ""
> }, {
> "name" : "AgencyID",
> "type" : [ "null", "int" ],
> "doc" : ""
> }, {
> "name" : "PlacementID",
> "type" : [ "null", "int" ],
> "doc" : ""
> }, {
> "name" : "CookieID",
> "type" : [ "null", "long" ],
> "doc" : ""
> }, {
> "name" : "WebProfileID",
> "type" : [ "null", "long" ],
> "doc" : ""
> }, {
> "name" : "IPAddress",
> "type" : [ "null", "string" ],
> "doc" : ""
> }, {
> "name" : "ZipCode",
> "type" : [ "null", "string" ],
> "doc" : ""
> }, {
> "name" : "DMAID",
> "type" : [ "null", "int" ],
> "doc" : ""
> }, {
> "name" : "Impressions",
> "type" : [ "null", "int" ],
> "doc" : ""
> }, {
> "name" : "Clicks",
> "type" : [ "null", "int" ],
> "doc" : ""
> }, {
> "name" : "PostImpressions",
> "type" : [ "null", "int" ],
> "doc" : ""
> }, {
> "name" : "PostClicks",
> "type" : [ "null", "int" ],
> "doc" : ""
> }, {
> "name" : "ApertureDataID",
> "type" : [ "null", "string" ],
> "doc" : ""
> }, {
> "name" : "ApertureCategoryID",
> "type" : [ "null", "string" ],
> "doc" : ""
> } ]
>}
>
>Also I can see that the file starts with
>Objavro.codecdeflateavro.schema�{"type":"record","name":"TUPLE_0","f
>ields"
>
>Hope that helps.
>
>Thanks
>
>On Fri, Jul 6, 2012 at 2:19 AM, Doug Cutting <cu...@apache.org> wrote:
>> You can use the Avro command-line tool to dump the metadata, which
>> will show the schema and codec:
>>
>> java -jar avro-tools.jar getmeta <file>
>>
>> Doug
>>
>> On Thu, Jul 5, 2012 at 3:11 PM, Ruslan Al-Fakikh <me...@gmail.com>
>>wrote:
>>> Hey Doug,
>>>
>>> Here is a little more of explanation
>>>
>>>http://mail-archives.apache.org/mod_mbox/avro-user/201207.mbox/%3CCACBYq
>>>wQWPaj8NaGVTOir4dO%2BOqri-UM-8RQ-5Uu2r2bLCyuBTA%40mail.gmail.com%3E
>>> I'll answer your questions later after some investigation
>>>
>>> Thank you!
>>>
>>>
>>> On Thu, Jul 5, 2012 at 9:24 PM, Doug Cutting <cu...@apache.org>
>>>wrote:
>>>> Rusian,
>>>>
>>>> This is unexpected. Perhaps we can understand it if we have more
>>>>information.
>>>>
>>>> What Writable class are you using for keys and values in the
>>>>SequenceFile?
>>>>
>>>> What schema are you using in the Avro data file?
>>>>
>>>> Can you provide small sample files of each and/or code that will
>>>>reproduce this?
>>>>
>>>> Thanks,
>>>>
>>>> Doug
>>>>
>>>> On Wed, Jul 4, 2012 at 6:32 AM, Ruslan Al-Fakikh
>>>><me...@gmail.com> wrote:
>>>>> Hello,
>>>>>
>>>>> In my organization currently we are evaluating Avro as a format. Our
>>>>> concern is file size. I've done some comparisons of a piece of our
>>>>> data.
>>>>> Say we have sequence files, compressed. The payload (values) are just
>>>>> lines. As far as I know we use line number as keys and we use the
>>>>> default codec for compression inside sequence files. The size is
>>>>>1.6G,
>>>>> when I put it to avro with deflate codec with deflate level 9 it
>>>>> becomes 2.2G.
>>>>> This is interesting, because the values in seq files are just string,
>>>>> but Avro has a normal schema with primitive types. And those are kept
>>>>> binary. Shouldn't Avro be less in size?
>>>>> Also I took another dataset which is 28G (gzip files, plain
>>>>> tab-delimited text, don't know what is the deflate level) and put it
>>>>> to Avro and it became 38G
>>>>> Why Avro is so big in size? Am I missing some size optimization?
>>>>>
>>>>> Thanks in advance!
Re: Avro file size is too big
Posted by Ruslan Al-Fakikh <me...@gmail.com>.
Hey
Sorry, couldn't use getmeta, It is in Avro 1.6, I have only 1.5 in my CDH distro
-bash-3.2$ java -jar avro-tools-1.5.4.jar getschema 000000_0.avro
{
"type" : "record",
"name" : "TUPLE_0",
"fields" : [ {
"name" : "EventDateIgnore",
"type" : [ "null", "string" ],
"doc" : ""
}, {
"name" : "DatranClientIDIgnore",
"type" : [ "null", "int" ],
"doc" : ""
}, {
"name" : "CreativeID",
"type" : [ "null", "int" ],
"doc" : ""
}, {
"name" : "AgencyID",
"type" : [ "null", "int" ],
"doc" : ""
}, {
"name" : "PlacementID",
"type" : [ "null", "int" ],
"doc" : ""
}, {
"name" : "CookieID",
"type" : [ "null", "long" ],
"doc" : ""
}, {
"name" : "WebProfileID",
"type" : [ "null", "long" ],
"doc" : ""
}, {
"name" : "IPAddress",
"type" : [ "null", "string" ],
"doc" : ""
}, {
"name" : "ZipCode",
"type" : [ "null", "string" ],
"doc" : ""
}, {
"name" : "DMAID",
"type" : [ "null", "int" ],
"doc" : ""
}, {
"name" : "Impressions",
"type" : [ "null", "int" ],
"doc" : ""
}, {
"name" : "Clicks",
"type" : [ "null", "int" ],
"doc" : ""
}, {
"name" : "PostImpressions",
"type" : [ "null", "int" ],
"doc" : ""
}, {
"name" : "PostClicks",
"type" : [ "null", "int" ],
"doc" : ""
}, {
"name" : "ApertureDataID",
"type" : [ "null", "string" ],
"doc" : ""
}, {
"name" : "ApertureCategoryID",
"type" : [ "null", "string" ],
"doc" : ""
} ]
}
Also I can see that the file starts with
Objavro.codecdeflateavro.schema�{"type":"record","name":"TUPLE_0","fields"
Hope that helps.
Thanks
On Fri, Jul 6, 2012 at 2:19 AM, Doug Cutting <cu...@apache.org> wrote:
> You can use the Avro command-line tool to dump the metadata, which
> will show the schema and codec:
>
> java -jar avro-tools.jar getmeta <file>
>
> Doug
>
> On Thu, Jul 5, 2012 at 3:11 PM, Ruslan Al-Fakikh <me...@gmail.com> wrote:
>> Hey Doug,
>>
>> Here is a little more of explanation
>> http://mail-archives.apache.org/mod_mbox/avro-user/201207.mbox/%3CCACBYqwQWPaj8NaGVTOir4dO%2BOqri-UM-8RQ-5Uu2r2bLCyuBTA%40mail.gmail.com%3E
>> I'll answer your questions later after some investigation
>>
>> Thank you!
>>
>>
>> On Thu, Jul 5, 2012 at 9:24 PM, Doug Cutting <cu...@apache.org> wrote:
>>> Rusian,
>>>
>>> This is unexpected. Perhaps we can understand it if we have more information.
>>>
>>> What Writable class are you using for keys and values in the SequenceFile?
>>>
>>> What schema are you using in the Avro data file?
>>>
>>> Can you provide small sample files of each and/or code that will reproduce this?
>>>
>>> Thanks,
>>>
>>> Doug
>>>
>>> On Wed, Jul 4, 2012 at 6:32 AM, Ruslan Al-Fakikh <me...@gmail.com> wrote:
>>>> Hello,
>>>>
>>>> In my organization currently we are evaluating Avro as a format. Our
>>>> concern is file size. I've done some comparisons of a piece of our
>>>> data.
>>>> Say we have sequence files, compressed. The payload (values) are just
>>>> lines. As far as I know we use line number as keys and we use the
>>>> default codec for compression inside sequence files. The size is 1.6G,
>>>> when I put it to avro with deflate codec with deflate level 9 it
>>>> becomes 2.2G.
>>>> This is interesting, because the values in seq files are just string,
>>>> but Avro has a normal schema with primitive types. And those are kept
>>>> binary. Shouldn't Avro be less in size?
>>>> Also I took another dataset which is 28G (gzip files, plain
>>>> tab-delimited text, don't know what is the deflate level) and put it
>>>> to Avro and it became 38G
>>>> Why Avro is so big in size? Am I missing some size optimization?
>>>>
>>>> Thanks in advance!
Re: Avro file size is too big
Posted by Doug Cutting <cu...@apache.org>.
You can use the Avro command-line tool to dump the metadata, which
will show the schema and codec:
java -jar avro-tools.jar getmeta <file>
Doug
On Thu, Jul 5, 2012 at 3:11 PM, Ruslan Al-Fakikh <me...@gmail.com> wrote:
> Hey Doug,
>
> Here is a little more of explanation
> http://mail-archives.apache.org/mod_mbox/avro-user/201207.mbox/%3CCACBYqwQWPaj8NaGVTOir4dO%2BOqri-UM-8RQ-5Uu2r2bLCyuBTA%40mail.gmail.com%3E
> I'll answer your questions later after some investigation
>
> Thank you!
>
>
> On Thu, Jul 5, 2012 at 9:24 PM, Doug Cutting <cu...@apache.org> wrote:
>> Rusian,
>>
>> This is unexpected. Perhaps we can understand it if we have more information.
>>
>> What Writable class are you using for keys and values in the SequenceFile?
>>
>> What schema are you using in the Avro data file?
>>
>> Can you provide small sample files of each and/or code that will reproduce this?
>>
>> Thanks,
>>
>> Doug
>>
>> On Wed, Jul 4, 2012 at 6:32 AM, Ruslan Al-Fakikh <me...@gmail.com> wrote:
>>> Hello,
>>>
>>> In my organization currently we are evaluating Avro as a format. Our
>>> concern is file size. I've done some comparisons of a piece of our
>>> data.
>>> Say we have sequence files, compressed. The payload (values) are just
>>> lines. As far as I know we use line number as keys and we use the
>>> default codec for compression inside sequence files. The size is 1.6G,
>>> when I put it to avro with deflate codec with deflate level 9 it
>>> becomes 2.2G.
>>> This is interesting, because the values in seq files are just string,
>>> but Avro has a normal schema with primitive types. And those are kept
>>> binary. Shouldn't Avro be less in size?
>>> Also I took another dataset which is 28G (gzip files, plain
>>> tab-delimited text, don't know what is the deflate level) and put it
>>> to Avro and it became 38G
>>> Why Avro is so big in size? Am I missing some size optimization?
>>>
>>> Thanks in advance!
Re: Avro file size is too big
Posted by Ruslan Al-Fakikh <me...@gmail.com>.
Hey Doug,
Here is a little more of explanation
http://mail-archives.apache.org/mod_mbox/avro-user/201207.mbox/%3CCACBYqwQWPaj8NaGVTOir4dO%2BOqri-UM-8RQ-5Uu2r2bLCyuBTA%40mail.gmail.com%3E
I'll answer your questions later after some investigation
Thank you!
On Thu, Jul 5, 2012 at 9:24 PM, Doug Cutting <cu...@apache.org> wrote:
> Rusian,
>
> This is unexpected. Perhaps we can understand it if we have more information.
>
> What Writable class are you using for keys and values in the SequenceFile?
>
> What schema are you using in the Avro data file?
>
> Can you provide small sample files of each and/or code that will reproduce this?
>
> Thanks,
>
> Doug
>
> On Wed, Jul 4, 2012 at 6:32 AM, Ruslan Al-Fakikh <me...@gmail.com> wrote:
>> Hello,
>>
>> In my organization currently we are evaluating Avro as a format. Our
>> concern is file size. I've done some comparisons of a piece of our
>> data.
>> Say we have sequence files, compressed. The payload (values) are just
>> lines. As far as I know we use line number as keys and we use the
>> default codec for compression inside sequence files. The size is 1.6G,
>> when I put it to avro with deflate codec with deflate level 9 it
>> becomes 2.2G.
>> This is interesting, because the values in seq files are just string,
>> but Avro has a normal schema with primitive types. And those are kept
>> binary. Shouldn't Avro be less in size?
>> Also I took another dataset which is 28G (gzip files, plain
>> tab-delimited text, don't know what is the deflate level) and put it
>> to Avro and it became 38G
>> Why Avro is so big in size? Am I missing some size optimization?
>>
>> Thanks in advance!
Re: Avro file size is too big
Posted by Doug Cutting <cu...@apache.org>.
Rusian,
This is unexpected. Perhaps we can understand it if we have more information.
What Writable class are you using for keys and values in the SequenceFile?
What schema are you using in the Avro data file?
Can you provide small sample files of each and/or code that will reproduce this?
Thanks,
Doug
On Wed, Jul 4, 2012 at 6:32 AM, Ruslan Al-Fakikh <me...@gmail.com> wrote:
> Hello,
>
> In my organization currently we are evaluating Avro as a format. Our
> concern is file size. I've done some comparisons of a piece of our
> data.
> Say we have sequence files, compressed. The payload (values) are just
> lines. As far as I know we use line number as keys and we use the
> default codec for compression inside sequence files. The size is 1.6G,
> when I put it to avro with deflate codec with deflate level 9 it
> becomes 2.2G.
> This is interesting, because the values in seq files are just string,
> but Avro has a normal schema with primitive types. And those are kept
> binary. Shouldn't Avro be less in size?
> Also I took another dataset which is 28G (gzip files, plain
> tab-delimited text, don't know what is the deflate level) and put it
> to Avro and it became 38G
> Why Avro is so big in size? Am I missing some size optimization?
>
> Thanks in advance!