You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by "Fabiano D. Beppler" <fd...@knewin.com> on 2011/02/18 19:53:14 UTC
Unit test (junit) very slow
Hi,
I am running a very simple JUnit test with HBase and the test takes a lot of
time to run when the computer is online (ie., connected to a wifi network).
When the computer is offline it runs a lot faster.
Online it takes more than 169 seconds to run
Offline it takes "only" 19 seconds to run
What is more interesting is that when the computer is online there isn't
other computers in the network, just a WIFI connection.
My computer is a MacBook Pro with Snow Leopard, HBase 0.20.6.
As you can see, the test is using the HBaseTestingUtility class. The
"problem" occurs when running line 7.
Is there anything I can do to avoid waiting so much time to run my JUnit
tests?
1 @Test
2 public void test1() throws Exception {
3 System.setProperty("test.build.data", "test_files/hbase/");
4
5 final HBaseTestingUtility hbaseUtility = new HBaseTestingUtility();
6 final HBaseConfiguration configuration =
hbaseUtility.getConfiguration();
7 hbaseUtility.startMiniCluster(); // "PROBLEM" HAPPENS WHEN STARTING
THE CLUSTER
8 final HTable table =
hbaseUtility.createTable(Bytes.toBytes("my_table"),
9 new byte[][] { Bytes.toBytes("my_family_1"),
Bytes.toBytes("my_family_2") });
10 final HTable recTable = new HTable(configuration, "my_table");
11 Assert.assertEquals("my_table",
Bytes.toString(recTable.getTableName()));
12 hbaseUtility.shutdownMiniCluster();
13 }
Thanks in advance.
Fabiano
Re: Unit test (junit) very slow
Posted by Jean-Daniel Cryans <jd...@apache.org>.
How long does it takes now?
Also, what did you change exactly?
Thx,
J-D
On Feb 19, 2011 12:09 PM, "Fabiano D. Beppler" <fd...@knewin.com> wrote:
> Thanks a lot J-D
> I changed the dns settings and it worked properly, although the test still
> takes more than 19 seconds.
> http://goo.gl/jA0oN
>
> On Fri, Feb 18, 2011 at 3:58 PM, Jean-Daniel Cryans <jdcryans@apache.org
>wrote:
>
>> There's probably (and I'm 99% sure) a DNS timeout happening when
>> resolving your machine's hostname. Review your DNS settings.
>>
>> J-D
>>
>> On Fri, Feb 18, 2011 at 10:53 AM, Fabiano D. Beppler <fd...@knewin.com>
>> wrote:
>> > Hi,
>> >
>> > I am running a very simple JUnit test with HBase and the test takes a
lot
>> of
>> > time to run when the computer is online (ie., connected to a wifi
>> network).
>> > When the computer is offline it runs a lot faster.
>> >
>> > Online it takes more than 169 seconds to run
>> > Offline it takes "only" 19 seconds to run
>> >
>> > What is more interesting is that when the computer is online there
isn't
>> > other computers in the network, just a WIFI connection.
>> > My computer is a MacBook Pro with Snow Leopard, HBase 0.20.6.
>> >
>> > As you can see, the test is using the HBaseTestingUtility class. The
>> > "problem" occurs when running line 7.
>> >
>> > Is there anything I can do to avoid waiting so much time to run my
JUnit
>> > tests?
>> >
>> > 1 @Test
>> > 2 public void test1() throws Exception {
>> > 3 System.setProperty("test.build.data", "test_files/hbase/");
>> > 4
>> > 5 final HBaseTestingUtility hbaseUtility = new
>> HBaseTestingUtility();
>> > 6 final HBaseConfiguration configuration =
>> > hbaseUtility.getConfiguration();
>> > 7 hbaseUtility.startMiniCluster(); // "PROBLEM" HAPPENS WHEN
>> STARTING
>> > THE CLUSTER
>> > 8 final HTable table =
>> > hbaseUtility.createTable(Bytes.toBytes("my_table"),
>> > 9 new byte[][] { Bytes.toBytes("my_family_1"),
>> > Bytes.toBytes("my_family_2") });
>> > 10 final HTable recTable = new HTable(configuration, "my_table");
>> > 11 Assert.assertEquals("my_table",
>> > Bytes.toString(recTable.getTableName()));
>> > 12 hbaseUtility.shutdownMiniCluster();
>> > 13 }
>> >
>> > Thanks in advance.
>> > Fabiano
>> >
>>
Re: Unit test (junit) very slow
Posted by "Fabiano D. Beppler" <fd...@knewin.com>.
Thanks a lot J-D
I changed the dns settings and it worked properly, although the test still
takes more than 19 seconds.
http://goo.gl/jA0oN
On Fri, Feb 18, 2011 at 3:58 PM, Jean-Daniel Cryans <jd...@apache.org>wrote:
> There's probably (and I'm 99% sure) a DNS timeout happening when
> resolving your machine's hostname. Review your DNS settings.
>
> J-D
>
> On Fri, Feb 18, 2011 at 10:53 AM, Fabiano D. Beppler <fd...@knewin.com>
> wrote:
> > Hi,
> >
> > I am running a very simple JUnit test with HBase and the test takes a lot
> of
> > time to run when the computer is online (ie., connected to a wifi
> network).
> > When the computer is offline it runs a lot faster.
> >
> > Online it takes more than 169 seconds to run
> > Offline it takes "only" 19 seconds to run
> >
> > What is more interesting is that when the computer is online there isn't
> > other computers in the network, just a WIFI connection.
> > My computer is a MacBook Pro with Snow Leopard, HBase 0.20.6.
> >
> > As you can see, the test is using the HBaseTestingUtility class. The
> > "problem" occurs when running line 7.
> >
> > Is there anything I can do to avoid waiting so much time to run my JUnit
> > tests?
> >
> > 1 @Test
> > 2 public void test1() throws Exception {
> > 3 System.setProperty("test.build.data", "test_files/hbase/");
> > 4
> > 5 final HBaseTestingUtility hbaseUtility = new
> HBaseTestingUtility();
> > 6 final HBaseConfiguration configuration =
> > hbaseUtility.getConfiguration();
> > 7 hbaseUtility.startMiniCluster(); // "PROBLEM" HAPPENS WHEN
> STARTING
> > THE CLUSTER
> > 8 final HTable table =
> > hbaseUtility.createTable(Bytes.toBytes("my_table"),
> > 9 new byte[][] { Bytes.toBytes("my_family_1"),
> > Bytes.toBytes("my_family_2") });
> > 10 final HTable recTable = new HTable(configuration, "my_table");
> > 11 Assert.assertEquals("my_table",
> > Bytes.toString(recTable.getTableName()));
> > 12 hbaseUtility.shutdownMiniCluster();
> > 13 }
> >
> > Thanks in advance.
> > Fabiano
> >
>
Re: Unit test (junit) very slow
Posted by Jean-Daniel Cryans <jd...@apache.org>.
There's probably (and I'm 99% sure) a DNS timeout happening when
resolving your machine's hostname. Review your DNS settings.
J-D
On Fri, Feb 18, 2011 at 10:53 AM, Fabiano D. Beppler <fd...@knewin.com> wrote:
> Hi,
>
> I am running a very simple JUnit test with HBase and the test takes a lot of
> time to run when the computer is online (ie., connected to a wifi network).
> When the computer is offline it runs a lot faster.
>
> Online it takes more than 169 seconds to run
> Offline it takes "only" 19 seconds to run
>
> What is more interesting is that when the computer is online there isn't
> other computers in the network, just a WIFI connection.
> My computer is a MacBook Pro with Snow Leopard, HBase 0.20.6.
>
> As you can see, the test is using the HBaseTestingUtility class. The
> "problem" occurs when running line 7.
>
> Is there anything I can do to avoid waiting so much time to run my JUnit
> tests?
>
> 1 @Test
> 2 public void test1() throws Exception {
> 3 System.setProperty("test.build.data", "test_files/hbase/");
> 4
> 5 final HBaseTestingUtility hbaseUtility = new HBaseTestingUtility();
> 6 final HBaseConfiguration configuration =
> hbaseUtility.getConfiguration();
> 7 hbaseUtility.startMiniCluster(); // "PROBLEM" HAPPENS WHEN STARTING
> THE CLUSTER
> 8 final HTable table =
> hbaseUtility.createTable(Bytes.toBytes("my_table"),
> 9 new byte[][] { Bytes.toBytes("my_family_1"),
> Bytes.toBytes("my_family_2") });
> 10 final HTable recTable = new HTable(configuration, "my_table");
> 11 Assert.assertEquals("my_table",
> Bytes.toString(recTable.getTableName()));
> 12 hbaseUtility.shutdownMiniCluster();
> 13 }
>
> Thanks in advance.
> Fabiano
>