You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by Demai Ni <ni...@gmail.com> on 2015/04/24 23:45:43 UTC
ORC file across multiple HDFS blocks
hi, Guys,
I am working on directly READ ORC files from HDFS cluster, and hopefully to
leverage HDFS local shortcuit READ (
http://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/ShortCircuitLocalReads.html)
as much as possible
According to ORC design, each ORC file usually contain several Stripes, and
each Stripe has default of 250MB for the efficient reads from HDFS. With
that, size of a ORC file can be easily at GB level, consisted of several
HDFS blocks. There is a good chance that
1) a ORC file across several HDFS data nodes.
2) a Stripe may across two HDFS blocks, and lands on two different physical
nodes
With this in mind, should I design my ORC file to
1) only contain one Stripe?
2) make ensure(either by larger HDFS block or smaller Stripe size) that
each ORC file contain only one HDFS block?
Does it look reasonable? thanks
Demai
Re: ORC file across multiple HDFS blocks
Posted by Demai Ni <ni...@gmail.com>.
Owen,
cool. That is great. Thanks
Demai
On Tue, Apr 28, 2015 at 11:10 AM, Owen O'Malley <om...@apache.org> wrote:
> You can also use the C++ reader to read a set of stripes. Look at the
> ReaderOptions.range(offset, length), which selects the range of stripes to
> process in terms of bytes.
>
> .. Owen
>
> On Tue, Apr 28, 2015 at 11:02 AM, Demai Ni <ni...@gmail.com> wrote:
>
>> Alan and Grant,
>>
>> many thanks. Grant's comment is exact on the point that I am exploring.
>>
>> A bit background here. I am working on a MPP way to read ORC files
>> through this C++ API (https://github.com/hortonworks/orc) by Owen and
>> team. The MPP mechanism is using one(or several) independent process per
>> each HDFS node, and work like a Client code to read ORC file(s). Currently,
>> the assignment of each process is scheduled at ORC file level, which would
>> encounter the issue of "lost of data locality" described by Grant. I
>> didn't realize that we can make the scheduling at stripe-level. Good to
>> know that, which surely make sense.
>>
>> Demai
>>
>> On Tue, Apr 28, 2015 at 8:34 AM, Grant Overby (groverby) <
>> groverby@cisco.com> wrote:
>>
>>> Expanding on Alan’s post:
>>>
>>> Files are intended to span many blocks and a single file may be read
>>> by many mappers. In order for a file to be read by many mappers, it goes
>>> through a process called input splits which splits the input around hdfs
>>> block boundaries.
>>>
>>> If a unit of data within a file crosses a hdfs block, a portion of
>>> that unit of data must be sent from the node which contains block/mapper of
>>> one portion to the node that contains the block/mapper of the other
>>> portion. Take a csv file for example, in this case a unit of data is a
>>> line, and transferring a portion of a line between boxes is no big deal.
>>>
>>> This changes a bit for orc files as the unit of data is a stripe. An
>>> orc stripe is typically a few hundred MB. Without some additional logic, a
>>> substantial part of data locality would be lost; however, orc has such
>>> additional logic. The stripe size of the orc file should be set a few MB
>>> below the hdfs block size and padding enable to produce a 1:1 relationship
>>> between an orc stripe and an hdfs block. How many stripes or blocks that
>>> are “in" a single file is of no consequence so long as this 1:1
>>> relationship is maintained.
>>>
>>> Below is an example config for 128mb hdfs blocks.
>>>
>>> Configuration writerConf = new Configuration();
>>> // other config
>>> OrcFile.WriterOptions writerOptions =
>>> OrcFile.writerOptions(writerConf);
>>> writerOptions.blockPadding(true);
>>> writerOptions.stripeSize(122 * 1024 * 1024);
>>> // other options
>>> Writer writer = OrcFile.createWriter(path, writerOptions);
>>>
>>>
>>>
>>> *Grant Overby*
>>> Software Engineer
>>> Cisco.com <http://www.cisco.com/>
>>> groverby@cisco.com
>>> Mobile: *865 724 4910 <865%20724%204910>*
>>>
>>>
>>>
>>> Think before you print.
>>>
>>> This email may contain confidential and privileged material for the sole
>>> use of the intended recipient. Any review, use, distribution or disclosure
>>> by others is strictly prohibited. If you are not the intended recipient (or
>>> authorized to receive for the recipient), please contact the sender by
>>> reply email and delete all copies of this message.
>>>
>>> Please click here
>>> <http://www.cisco.com/web/about/doing_business/legal/cri/index.html> for
>>> Company Registration Information.
>>>
>>>
>>>
>>>
>>> From: Alan Gates <al...@gmail.com>
>>> Reply-To: "user@hive.apache.org" <us...@hive.apache.org>
>>> Date: Monday, April 27, 2015 at 2:05 PM
>>> To: "user@hive.apache.org" <us...@hive.apache.org>
>>> Subject: Re: ORC file across multiple HDFS blocks
>>>
>>> to cross blocks and hence n
>>>
>>
>>
>
Re: ORC file across multiple HDFS blocks
Posted by Owen O'Malley <om...@apache.org>.
You can also use the C++ reader to read a set of stripes. Look at the
ReaderOptions.range(offset, length), which selects the range of stripes to
process in terms of bytes.
.. Owen
On Tue, Apr 28, 2015 at 11:02 AM, Demai Ni <ni...@gmail.com> wrote:
> Alan and Grant,
>
> many thanks. Grant's comment is exact on the point that I am exploring.
>
> A bit background here. I am working on a MPP way to read ORC files through
> this C++ API (https://github.com/hortonworks/orc) by Owen and team. The
> MPP mechanism is using one(or several) independent process per each HDFS
> node, and work like a Client code to read ORC file(s). Currently, the
> assignment of each process is scheduled at ORC file level, which would
> encounter the issue of "lost of data locality" described by Grant. I
> didn't realize that we can make the scheduling at stripe-level. Good to
> know that, which surely make sense.
>
> Demai
>
> On Tue, Apr 28, 2015 at 8:34 AM, Grant Overby (groverby) <
> groverby@cisco.com> wrote:
>
>> Expanding on Alan’s post:
>>
>> Files are intended to span many blocks and a single file may be read by
>> many mappers. In order for a file to be read by many mappers, it goes
>> through a process called input splits which splits the input around hdfs
>> block boundaries.
>>
>> If a unit of data within a file crosses a hdfs block, a portion of that
>> unit of data must be sent from the node which contains block/mapper of one
>> portion to the node that contains the block/mapper of the other portion.
>> Take a csv file for example, in this case a unit of data is a line, and
>> transferring a portion of a line between boxes is no big deal.
>>
>> This changes a bit for orc files as the unit of data is a stripe. An
>> orc stripe is typically a few hundred MB. Without some additional logic, a
>> substantial part of data locality would be lost; however, orc has such
>> additional logic. The stripe size of the orc file should be set a few MB
>> below the hdfs block size and padding enable to produce a 1:1 relationship
>> between an orc stripe and an hdfs block. How many stripes or blocks that
>> are “in" a single file is of no consequence so long as this 1:1
>> relationship is maintained.
>>
>> Below is an example config for 128mb hdfs blocks.
>>
>> Configuration writerConf = new Configuration();
>> // other config
>> OrcFile.WriterOptions writerOptions =
>> OrcFile.writerOptions(writerConf);
>> writerOptions.blockPadding(true);
>> writerOptions.stripeSize(122 * 1024 * 1024);
>> // other options
>> Writer writer = OrcFile.createWriter(path, writerOptions);
>>
>>
>>
>> *Grant Overby*
>> Software Engineer
>> Cisco.com <http://www.cisco.com/>
>> groverby@cisco.com
>> Mobile: *865 724 4910 <865%20724%204910>*
>>
>>
>>
>> Think before you print.
>>
>> This email may contain confidential and privileged material for the sole
>> use of the intended recipient. Any review, use, distribution or disclosure
>> by others is strictly prohibited. If you are not the intended recipient (or
>> authorized to receive for the recipient), please contact the sender by
>> reply email and delete all copies of this message.
>>
>> Please click here
>> <http://www.cisco.com/web/about/doing_business/legal/cri/index.html> for
>> Company Registration Information.
>>
>>
>>
>>
>> From: Alan Gates <al...@gmail.com>
>> Reply-To: "user@hive.apache.org" <us...@hive.apache.org>
>> Date: Monday, April 27, 2015 at 2:05 PM
>> To: "user@hive.apache.org" <us...@hive.apache.org>
>> Subject: Re: ORC file across multiple HDFS blocks
>>
>> to cross blocks and hence n
>>
>
>
Re: ORC file across multiple HDFS blocks
Posted by Demai Ni <ni...@gmail.com>.
Alan and Grant,
many thanks. Grant's comment is exact on the point that I am exploring.
A bit background here. I am working on a MPP way to read ORC files through
this C++ API (https://github.com/hortonworks/orc) by Owen and team. The MPP
mechanism is using one(or several) independent process per each HDFS node,
and work like a Client code to read ORC file(s). Currently, the assignment
of each process is scheduled at ORC file level, which would encounter the
issue of "lost of data locality" described by Grant. I didn't realize that
we can make the scheduling at stripe-level. Good to know that, which
surely make sense.
Demai
On Tue, Apr 28, 2015 at 8:34 AM, Grant Overby (groverby) <groverby@cisco.com
> wrote:
> Expanding on Alan’s post:
>
> Files are intended to span many blocks and a single file may be read by
> many mappers. In order for a file to be read by many mappers, it goes
> through a process called input splits which splits the input around hdfs
> block boundaries.
>
> If a unit of data within a file crosses a hdfs block, a portion of that
> unit of data must be sent from the node which contains block/mapper of one
> portion to the node that contains the block/mapper of the other portion.
> Take a csv file for example, in this case a unit of data is a line, and
> transferring a portion of a line between boxes is no big deal.
>
> This changes a bit for orc files as the unit of data is a stripe. An orc
> stripe is typically a few hundred MB. Without some additional logic, a
> substantial part of data locality would be lost; however, orc has such
> additional logic. The stripe size of the orc file should be set a few MB
> below the hdfs block size and padding enable to produce a 1:1 relationship
> between an orc stripe and an hdfs block. How many stripes or blocks that
> are “in" a single file is of no consequence so long as this 1:1
> relationship is maintained.
>
> Below is an example config for 128mb hdfs blocks.
>
> Configuration writerConf = new Configuration();
> // other config
> OrcFile.WriterOptions writerOptions =
> OrcFile.writerOptions(writerConf);
> writerOptions.blockPadding(true);
> writerOptions.stripeSize(122 * 1024 * 1024);
> // other options
> Writer writer = OrcFile.createWriter(path, writerOptions);
>
>
>
> *Grant Overby*
> Software Engineer
> Cisco.com <http://www.cisco.com/>
> groverby@cisco.com
> Mobile: *865 724 4910 <865%20724%204910>*
>
>
>
> Think before you print.
>
> This email may contain confidential and privileged material for the sole
> use of the intended recipient. Any review, use, distribution or disclosure
> by others is strictly prohibited. If you are not the intended recipient (or
> authorized to receive for the recipient), please contact the sender by
> reply email and delete all copies of this message.
>
> Please click here
> <http://www.cisco.com/web/about/doing_business/legal/cri/index.html> for
> Company Registration Information.
>
>
>
>
> From: Alan Gates <al...@gmail.com>
> Reply-To: "user@hive.apache.org" <us...@hive.apache.org>
> Date: Monday, April 27, 2015 at 2:05 PM
> To: "user@hive.apache.org" <us...@hive.apache.org>
> Subject: Re: ORC file across multiple HDFS blocks
>
> to cross blocks and hence n
>
Re: ORC file across multiple HDFS blocks
Posted by "Grant Overby (groverby)" <gr...@cisco.com>.
Expanding on Alan’s post:
Files are intended to span many blocks and a single file may be read by many mappers. In order for a file to be read by many mappers, it goes through a process called input splits which splits the input around hdfs block boundaries.
If a unit of data within a file crosses a hdfs block, a portion of that unit of data must be sent from the node which contains block/mapper of one portion to the node that contains the block/mapper of the other portion. Take a csv file for example, in this case a unit of data is a line, and transferring a portion of a line between boxes is no big deal.
This changes a bit for orc files as the unit of data is a stripe. An orc stripe is typically a few hundred MB. Without some additional logic, a substantial part of data locality would be lost; however, orc has such additional logic. The stripe size of the orc file should be set a few MB below the hdfs block size and padding enable to produce a 1:1 relationship between an orc stripe and an hdfs block. How many stripes or blocks that are “in" a single file is of no consequence so long as this 1:1 relationship is maintained.
Below is an example config for 128mb hdfs blocks.
Configuration writerConf = new Configuration();
// other config
OrcFile.WriterOptions writerOptions = OrcFile.writerOptions(writerConf);
writerOptions.blockPadding(true);
writerOptions.stripeSize(122 * 1024 * 1024);
// other options
Writer writer = OrcFile.createWriter(path, writerOptions);
[http://www.cisco.com/web/europe/images/email/signature/est2014/logo_06.png?ct=1398192119726]
Grant Overby
Software Engineer
Cisco.com<http://www.cisco.com/>
groverby@cisco.com<ma...@cisco.com>
Mobile: 865 724 4910
[http://www.cisco.com/assets/swa/img/thinkbeforeyouprint.gif] Think before you print.
This email may contain confidential and privileged material for the sole use of the intended recipient. Any review, use, distribution or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive for the recipient), please contact the sender by reply email and delete all copies of this message.
Please click here<http://www.cisco.com/web/about/doing_business/legal/cri/index.html> for Company Registration Information.
From: Alan Gates <al...@gmail.com>>
Reply-To: "user@hive.apache.org<ma...@hive.apache.org>" <us...@hive.apache.org>>
Date: Monday, April 27, 2015 at 2:05 PM
To: "user@hive.apache.org<ma...@hive.apache.org>" <us...@hive.apache.org>>
Subject: Re: ORC file across multiple HDFS blocks
to cross blocks and hence n
Re: ORC file across multiple HDFS blocks
Posted by Alan Gates <al...@gmail.com>.
No, you don't want to be designing ORC files to not cross block
boundaries. Engines in Hadoop (MapReduce, Tez, etc.) are all built to
handle the fact that files tend to cross blocks and hence nodes. There
is value in lining up stripe size and HDFS block size so that your
stripes don't straddle blocks, but that has been on by default since at
least Hive 0.13.
Alan.
> Demai Ni <ma...@gmail.com>
> April 24, 2015 at 14:45
> hi, Guys,
>
> I am working on directly READ ORC files from HDFS cluster, and
> hopefully to leverage HDFS local shortcuit READ
> (http://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/ShortCircuitLocalReads.html)
> as much as possible
>
> According to ORC design, each ORC file usually contain several
> Stripes, and each Stripe has default of 250MB for the efficient reads
> from HDFS. With that, size of a ORC file can be easily at GB level,
> consisted of several HDFS blocks. There is a good chance that
> 1) a ORC file across several HDFS data nodes.
> 2) a Stripe may across two HDFS blocks, and lands on two different
> physical nodes
>
> With this in mind, should I design my ORC file to
> 1) only contain one Stripe?
> 2) make ensure(either by larger HDFS block or smaller Stripe size)
> that each ORC file contain only one HDFS block?
>
> Does it look reasonable? thanks
>
> Demai
>
>
>
>