You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Nicolas Seyvet <ni...@gmail.com> on 2013/03/21 14:29:47 UTC

How to prevent major compaction when doing bulk load provisioning?

Hi,

We are using code similar to
https://github.com/jrkinley/hbase-bulk-import-example/ in order to
benchmark our HBase cluster.  We are running a CDH4 installation, and HBase
is version 0.92.1-cdh4.1.1..  The cluster is composed of 12 slaves and 1
master and 1 secondary master.

During the bulk load insert, roughly within 3 hours after the start
(~200Gb), we notice a large drop in performance in the insert rate. At the
same time, there is a spike in IO and CPU usage.  Connecting to a Region
Server (RS), the Monitored Task section shows that a compaction is started.

I have set hbase.hregion.max.filesize to 107374182400 (100Gb), and disable
automatic major compaction hbase.hregion.majorcompactionis set to 0.

What we are doing is that we have 1000 files of synthetic data (csv), where
each row in a file is one row to insert into HBase, each file contains 600K
rows (or 600K events).  Our loader works in the following way:
1. Look for a file
2. When a file is found, prepare a job for that file
3. Launch job
4. Wait for completion
5. Compute insert rate (nb of rows /time)
6. Repeat from 1 until there are no more files.

What I understand of the bulk load M/R job is that it produces one HFile
for each Region.

Questions:
- How is HStoreFileSize calclulated?
- What do HStoreFileSize, storeFileSize and hbase.hregion.max.filesize have
in common?
- Can the number of HFiles trigger a major compaction?

Thx for help.  I hope my questions make sense.

/Nicolas

Re: How to prevent major compaction when doing bulk load provisioning?

Posted by Amit Sela <am...@infolinks.com>.
Did you try pre-splitting your table before bulk loading ?

On Thu, Mar 21, 2013 at 3:29 PM, Nicolas Seyvet <ni...@gmail.com>wrote:

> Hi,
>
> We are using code similar to
> https://github.com/jrkinley/hbase-bulk-import-example/ in order to
> benchmark our HBase cluster.  We are running a CDH4 installation, and HBase
> is version 0.92.1-cdh4.1.1..  The cluster is composed of 12 slaves and 1
> master and 1 secondary master.
>
> During the bulk load insert, roughly within 3 hours after the start
> (~200Gb), we notice a large drop in performance in the insert rate. At the
> same time, there is a spike in IO and CPU usage.  Connecting to a Region
> Server (RS), the Monitored Task section shows that a compaction is started.
>
> I have set hbase.hregion.max.filesize to 107374182400 (100Gb), and disable
> automatic major compaction hbase.hregion.majorcompactionis set to 0.
>
> What we are doing is that we have 1000 files of synthetic data (csv), where
> each row in a file is one row to insert into HBase, each file contains 600K
> rows (or 600K events).  Our loader works in the following way:
> 1. Look for a file
> 2. When a file is found, prepare a job for that file
> 3. Launch job
> 4. Wait for completion
> 5. Compute insert rate (nb of rows /time)
> 6. Repeat from 1 until there are no more files.
>
> What I understand of the bulk load M/R job is that it produces one HFile
> for each Region.
>
> Questions:
> - How is HStoreFileSize calclulated?
> - What do HStoreFileSize, storeFileSize and hbase.hregion.max.filesize have
> in common?
> - Can the number of HFiles trigger a major compaction?
>
> Thx for help.  I hope my questions make sense.
>
> /Nicolas
>

Re: How to prevent major compaction when doing bulk load provisioning?

Posted by Ted Yu <yu...@gmail.com>.
For your 3rd question, if you set hbase.hregion.majorcompaction in your
column family, that would override system-level setting:

  long getNextMajorCompactTime() {
    // default = 24hrs
    long ret = conf.getLong(HConstants.MAJOR_COMPACTION_PERIOD,
1000*60*60*24);
    if (family.getValue(HConstants.MAJOR_COMPACTION_PERIOD) != null) {
      String strCompactionTime =
        family.getValue(HConstants.MAJOR_COMPACTION_PERIOD);
      ret = (new Long(strCompactionTime)).longValue();
    }

The above is from 0.94 codebase, BTW.

On Thu, Mar 21, 2013 at 6:29 AM, Nicolas Seyvet <ni...@gmail.com>wrote:

> Hi,
>
> We are using code similar to
> https://github.com/jrkinley/hbase-bulk-import-example/ in order to
> benchmark our HBase cluster.  We are running a CDH4 installation, and HBase
> is version 0.92.1-cdh4.1.1..  The cluster is composed of 12 slaves and 1
> master and 1 secondary master.
>
> During the bulk load insert, roughly within 3 hours after the start
> (~200Gb), we notice a large drop in performance in the insert rate. At the
> same time, there is a spike in IO and CPU usage.  Connecting to a Region
> Server (RS), the Monitored Task section shows that a compaction is started.
>
> I have set hbase.hregion.max.filesize to 107374182400 (100Gb), and disable
> automatic major compaction hbase.hregion.majorcompactionis set to 0.
>
> What we are doing is that we have 1000 files of synthetic data (csv), where
> each row in a file is one row to insert into HBase, each file contains 600K
> rows (or 600K events).  Our loader works in the following way:
> 1. Look for a file
> 2. When a file is found, prepare a job for that file
> 3. Launch job
> 4. Wait for completion
> 5. Compute insert rate (nb of rows /time)
> 6. Repeat from 1 until there are no more files.
>
> What I understand of the bulk load M/R job is that it produces one HFile
> for each Region.
>
> Questions:
> - How is HStoreFileSize calclulated?
> - What do HStoreFileSize, storeFileSize and hbase.hregion.max.filesize have
> in common?
> - Can the number of HFiles trigger a major compaction?
>
> Thx for help.  I hope my questions make sense.
>
> /Nicolas
>

Re: How to prevent major compaction when doing bulk load provisioning?

Posted by Jean-Daniel Cryans <jd...@apache.org>.
On Fri, Mar 22, 2013 at 12:12 AM, Nicolas Seyvet
<ni...@gmail.com> wrote:
> @J-D: Thanks, this sounds very likely.
>
> One more thing, from the logs of one slave, I can see the following:
> 2013-03-21 22:27:15,041 INFO org.apache.hadoop.hbase.regionserver.Store:
> Completed major compaction of 9 file(s) in f of
> rc_nise,$,1363860406830.5689430f7a27cc511f99dcb62001edc6. into
> 5418126f3d154ef3aca8027e04512279, size=8.3g; total size for store is 8.3g
> [...]
> 2013-03-21 23:34:31,836 INFO org.apache.hadoop.hbase.regionserver.Store:
> Completed major compaction of 5 file(s) in f of
> rc_nise,$,1363860406830.5689430f7a27cc511f99dcb62001edc6. into
> 3bdeb58c57af4ee1a92d22865e707416, size=8.3g; total size for store is 8.3g
>
> Are not those the sign that a major compaction also occurred?
> And if so, what could have triggered it?

If the compaction algo selects all the files for compaction, it gets
upgraded into a major compaction because it's essentially the same
thing.

>
>
>
>
>
> On Thu, Mar 21, 2013 at 8:06 PM, Nicolas Seyvet <ni...@gmail.com>wrote:
>
>> @Ram: You are entirely correct, I made the exact same mistakes of mixing
>> up Large and minor compaction.  By looking closely, what I see is that at
>> around 200 HFiles per region it starts minor compacting files per group of
>> 10 HFiles.  The "problem" seems that this minor compacting never stops even
>> when there are about 20 HFiles left.  It just keep on going and on taking
>> more and more time (I guess because the files to compact are getting
>> bigger).
>>
>> Of course in parallel we keep on adding more and more data.
>>
>> @J-D: "It seems to me that it would be better if you were able to do a
>> single load for all your files." Yes, I agree.. but that is not what we
>> are testing, our use case is to use 1min batch files.
>>
>>
>>
>>
>>
>>

Re: How to prevent major compaction when doing bulk load provisioning?

Posted by Nicolas Seyvet <ni...@gmail.com>.
@J-D: Thanks, this sounds very likely.

One more thing, from the logs of one slave, I can see the following:
2013-03-21 22:27:15,041 INFO org.apache.hadoop.hbase.regionserver.Store:
Completed major compaction of 9 file(s) in f of
rc_nise,$,1363860406830.5689430f7a27cc511f99dcb62001edc6. into
5418126f3d154ef3aca8027e04512279, size=8.3g; total size for store is 8.3g
[...]
2013-03-21 23:34:31,836 INFO org.apache.hadoop.hbase.regionserver.Store:
Completed major compaction of 5 file(s) in f of
rc_nise,$,1363860406830.5689430f7a27cc511f99dcb62001edc6. into
3bdeb58c57af4ee1a92d22865e707416, size=8.3g; total size for store is 8.3g

Are not those the sign that a major compaction also occurred?
And if so, what could have triggered it?





On Thu, Mar 21, 2013 at 8:06 PM, Nicolas Seyvet <ni...@gmail.com>wrote:

> @Ram: You are entirely correct, I made the exact same mistakes of mixing
> up Large and minor compaction.  By looking closely, what I see is that at
> around 200 HFiles per region it starts minor compacting files per group of
> 10 HFiles.  The "problem" seems that this minor compacting never stops even
> when there are about 20 HFiles left.  It just keep on going and on taking
> more and more time (I guess because the files to compact are getting
> bigger).
>
> Of course in parallel we keep on adding more and more data.
>
> @J-D: "It seems to me that it would be better if you were able to do a
> single load for all your files." Yes, I agree.. but that is not what we
> are testing, our use case is to use 1min batch files.
>
>
>
>
>
>

Re: How to prevent major compaction when doing bulk load provisioning?

Posted by Jean-Daniel Cryans <jd...@apache.org>.
On Thu, Mar 21, 2013 at 12:06 PM, Nicolas Seyvet
<ni...@gmail.com> wrote:
> @Ram: You are entirely correct, I made the exact same mistakes of mixing up
> Large and minor compaction.  By looking closely, what I see is that at
> around 200 HFiles per region it starts minor compacting files per group of
> 10 HFiles.  The "problem" seems that this minor compacting never stops even
> when there are about 20 HFiles left.  It just keep on going and on taking
> more and more time (I guess because the files to compact are getting
> bigger).
>
> Of course in parallel we keep on adding more and more data.
>
> @J-D: "It seems to me that it would be better if you were able to do a
> single load for all your files." Yes, I agree.. but that is not what we are
> testing, our use case is to use 1min batch files.

I worked on a very similar use case recently and would recommend
against doing bulk loads like this. The way bulk loaded files are
treated by the compaction selection algorithm is broken when loads are
done in a continuous fashion. The solution to this is in HBASE-7842[1]
but it is still being worked on.

What you are seeing is that the files picked up for compactions will
often include the bigger already-compacted files. As those files get
bigger, compactions will take longer and longer, up to a point where
the data that is selected for compaction is greater than your
compacting capacity.

The workaround would be to use the normal API as files will be more
properly selected for compaction, but it won't be as fast/efficient as
the continuous bulk load solution should be if the selection algo
wasn't broken.

J-D

1. https://issues.apache.org/jira/browse/HBASE-7842

Re: How to prevent major compaction when doing bulk load provisioning?

Posted by Nicolas Seyvet <ni...@gmail.com>.
@Ram: You are entirely correct, I made the exact same mistakes of mixing up
Large and minor compaction.  By looking closely, what I see is that at
around 200 HFiles per region it starts minor compacting files per group of
10 HFiles.  The "problem" seems that this minor compacting never stops even
when there are about 20 HFiles left.  It just keep on going and on taking
more and more time (I guess because the files to compact are getting
bigger).

Of course in parallel we keep on adding more and more data.

@J-D: "It seems to me that it would be better if you were able to do a
single load for all your files." Yes, I agree.. but that is not what we are
testing, our use case is to use 1min batch files.

Re: How to prevent major compaction when doing bulk load provisioning?

Posted by Ted Yu <yu...@gmail.com>.
Nicolas:
Here is what I said:

bq.  if you set hbase.hregion.majorcompaction in your column family, that
would override system-level setting

I didn't say 'change the overall system behavior'

Cheers

On Thu, Mar 21, 2013 at 10:52 AM, Nicolas Seyvet
<ni...@gmail.com>wrote:

> @Amit: Yes, we pre-split with 42 regions.
>
> @Ted: Why would setting hbase.hregion.majorcompaction at table creation
> change the overall system behavior?
>
>

Re: How to prevent major compaction when doing bulk load provisioning?

Posted by Nicolas Seyvet <ni...@gmail.com>.
@Amit: Yes, we pre-split with 42 regions.

@Ted: Why would setting hbase.hregion.majorcompaction at table creation
change the overall system behavior?


Re: How to prevent major compaction when doing bulk load provisioning?

Posted by ramkrishna vasudevan <ra...@gmail.com>.
I remember there was another user too who got the same issue. He thought
the minor compaction to be major compaction and was saying that the setting
that we provide to disable the majorcompaction was not working/not taking
effect.

Regards
Ram

On Thu, Mar 21, 2013 at 11:33 PM, Jean-Daniel Cryans <jd...@apache.org>wrote:

> You are likely just hitting the threshold for a minor compaction and
> by picking up all the files (I'm making a guess that it does) it gets
> upgraded to a major compaction. The threshold is 3 by default.
>
> So after loading 3 files you should get a compaction per region, then
> every other 2 loading you will trigger another per region.
>
> It seems to me that it would be better if you were able to do a single
> load for all your files.
>
> J-D
>
> On Thu, Mar 21, 2013 at 6:29 AM, Nicolas Seyvet
> <ni...@gmail.com> wrote:
> > Hi,
> >
> > We are using code similar to
> > https://github.com/jrkinley/hbase-bulk-import-example/ in order to
> > benchmark our HBase cluster.  We are running a CDH4 installation, and
> HBase
> > is version 0.92.1-cdh4.1.1..  The cluster is composed of 12 slaves and 1
> > master and 1 secondary master.
> >
> > During the bulk load insert, roughly within 3 hours after the start
> > (~200Gb), we notice a large drop in performance in the insert rate. At
> the
> > same time, there is a spike in IO and CPU usage.  Connecting to a Region
> > Server (RS), the Monitored Task section shows that a compaction is
> started.
> >
> > I have set hbase.hregion.max.filesize to 107374182400 (100Gb), and
> disable
> > automatic major compaction hbase.hregion.majorcompactionis set to 0.
> >
> > What we are doing is that we have 1000 files of synthetic data (csv),
> where
> > each row in a file is one row to insert into HBase, each file contains
> 600K
> > rows (or 600K events).  Our loader works in the following way:
> > 1. Look for a file
> > 2. When a file is found, prepare a job for that file
> > 3. Launch job
> > 4. Wait for completion
> > 5. Compute insert rate (nb of rows /time)
> > 6. Repeat from 1 until there are no more files.
> >
> > What I understand of the bulk load M/R job is that it produces one HFile
> > for each Region.
> >
> > Questions:
> > - How is HStoreFileSize calclulated?
> > - What do HStoreFileSize, storeFileSize and hbase.hregion.max.filesize
> have
> > in common?
> > - Can the number of HFiles trigger a major compaction?
> >
> > Thx for help.  I hope my questions make sense.
> >
> > /Nicolas
>

Re: How to prevent major compaction when doing bulk load provisioning?

Posted by Jean-Daniel Cryans <jd...@apache.org>.
You are likely just hitting the threshold for a minor compaction and
by picking up all the files (I'm making a guess that it does) it gets
upgraded to a major compaction. The threshold is 3 by default.

So after loading 3 files you should get a compaction per region, then
every other 2 loading you will trigger another per region.

It seems to me that it would be better if you were able to do a single
load for all your files.

J-D

On Thu, Mar 21, 2013 at 6:29 AM, Nicolas Seyvet
<ni...@gmail.com> wrote:
> Hi,
>
> We are using code similar to
> https://github.com/jrkinley/hbase-bulk-import-example/ in order to
> benchmark our HBase cluster.  We are running a CDH4 installation, and HBase
> is version 0.92.1-cdh4.1.1..  The cluster is composed of 12 slaves and 1
> master and 1 secondary master.
>
> During the bulk load insert, roughly within 3 hours after the start
> (~200Gb), we notice a large drop in performance in the insert rate. At the
> same time, there is a spike in IO and CPU usage.  Connecting to a Region
> Server (RS), the Monitored Task section shows that a compaction is started.
>
> I have set hbase.hregion.max.filesize to 107374182400 (100Gb), and disable
> automatic major compaction hbase.hregion.majorcompactionis set to 0.
>
> What we are doing is that we have 1000 files of synthetic data (csv), where
> each row in a file is one row to insert into HBase, each file contains 600K
> rows (or 600K events).  Our loader works in the following way:
> 1. Look for a file
> 2. When a file is found, prepare a job for that file
> 3. Launch job
> 4. Wait for completion
> 5. Compute insert rate (nb of rows /time)
> 6. Repeat from 1 until there are no more files.
>
> What I understand of the bulk load M/R job is that it produces one HFile
> for each Region.
>
> Questions:
> - How is HStoreFileSize calclulated?
> - What do HStoreFileSize, storeFileSize and hbase.hregion.max.filesize have
> in common?
> - Can the number of HFiles trigger a major compaction?
>
> Thx for help.  I hope my questions make sense.
>
> /Nicolas