You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Mohit Anchlia <mo...@gmail.com> on 2012/07/24 00:48:42 UTC

Insert blocked

I am writing a stress tool to test my specific use case. In my current
implementation HTable is a global static variable that I initialize just
once and use it accross multiple threads. Is this ok?

My row key consists of (timestamp - (timestamp % 1000)) and cols are
counters. What I am seeing is that when I run my test after first row is
created the application just hangs. I just wanted to check if there are
obvious things that I should watch out for.

I am currently testing few threads in eclipse, but I'll still try and
generate stackTrace

Re: Insert blocked

Posted by lars hofhansl <lh...@yahoo.com>.
You share it for as many operation it makes sense to keep the HTable.
In an AppServer it would be for the duration of an incoming request for example (i.e. each thread creates and destroys its own HTables as needed).


The HTable is just then just used as a functional construct to execute RPCs and holds references to a preexisting Connection and Threadpool... Very fast to create and collect.

-- Lars



----- Original Message -----
From: Mohit Anchlia <mo...@gmail.com>
To: user@hbase.apache.org
Cc: 
Sent: Tuesday, July 24, 2012 1:04 PM
Subject: Re: Insert blocked

On Tue, Jul 24, 2012 at 12:55 PM, Elliott Clark <ec...@stumbleupon.com>wrote:

> Thanks I hadn't seen that before
>

Do you mean in your code you close HTableInterface after each put/get/scan
operations?


>
> On Mon, Jul 23, 2012 at 10:29 PM, lars hofhansl <lh...@yahoo.com>
> wrote:
>
> > Or you can pre-create your HConnection and Threadpool and use the HTable
> > constructor that takes these as arguments.
> > That is faster and less "byzantine" compared to the HTablePool "monster".
> >
> > Also see here (if you don't mind the plug):
> > http://hadoop-hbase.blogspot.com/2011/12/long-running-hbase-clients.html
> >
> >
> > -- Lars
> >
> >
> >
> > ----- Original Message -----
> > From: Elliott Clark <ec...@stumbleupon.com>
> > To: user@hbase.apache.org
> > Cc:
> > Sent: Monday, July 23, 2012 3:54 PM
> > Subject: Re: Insert blocked
> >
> > HTable is not thread safe[1]. It's better to use HTablePool if you want
> to
> > share things across multiple threads.[2]
> >
> > 1
> >
> http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/HTable.html
> > 2
> >
> >
> http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/HTablePool.html
> >
> > On Mon, Jul 23, 2012 at 3:48 PM, Mohit Anchlia <mohitanchlia@gmail.com
> > >wrote:
> >
> > > I am writing a stress tool to test my specific use case. In my current
> > > implementation HTable is a global static variable that I initialize
> just
> > > once and use it accross multiple threads. Is this ok?
> > >
> > > My row key consists of (timestamp - (timestamp % 1000)) and cols are
> > > counters. What I am seeing is that when I run my test after first row
> is
> > > created the application just hangs. I just wanted to check if there are
> > > obvious things that I should watch out for.
> > >
> > > I am currently testing few threads in eclipse, but I'll still try and
> > > generate stackTrace
> > >
> >
> >
>


Re: Insert blocked

Posted by Mohit Anchlia <mo...@gmail.com>.
On Tue, Jul 24, 2012 at 12:55 PM, Elliott Clark <ec...@stumbleupon.com>wrote:

> Thanks I hadn't seen that before
>

Do you mean in your code you close HTableInterface after each put/get/scan
operations?


>
> On Mon, Jul 23, 2012 at 10:29 PM, lars hofhansl <lh...@yahoo.com>
> wrote:
>
> > Or you can pre-create your HConnection and Threadpool and use the HTable
> > constructor that takes these as arguments.
> > That is faster and less "byzantine" compared to the HTablePool "monster".
> >
> > Also see here (if you don't mind the plug):
> > http://hadoop-hbase.blogspot.com/2011/12/long-running-hbase-clients.html
> >
> >
> > -- Lars
> >
> >
> >
> > ----- Original Message -----
> > From: Elliott Clark <ec...@stumbleupon.com>
> > To: user@hbase.apache.org
> > Cc:
> > Sent: Monday, July 23, 2012 3:54 PM
> > Subject: Re: Insert blocked
> >
> > HTable is not thread safe[1]. It's better to use HTablePool if you want
> to
> > share things across multiple threads.[2]
> >
> > 1
> >
> http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/HTable.html
> > 2
> >
> >
> http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/HTablePool.html
> >
> > On Mon, Jul 23, 2012 at 3:48 PM, Mohit Anchlia <mohitanchlia@gmail.com
> > >wrote:
> >
> > > I am writing a stress tool to test my specific use case. In my current
> > > implementation HTable is a global static variable that I initialize
> just
> > > once and use it accross multiple threads. Is this ok?
> > >
> > > My row key consists of (timestamp - (timestamp % 1000)) and cols are
> > > counters. What I am seeing is that when I run my test after first row
> is
> > > created the application just hangs. I just wanted to check if there are
> > > obvious things that I should watch out for.
> > >
> > > I am currently testing few threads in eclipse, but I'll still try and
> > > generate stackTrace
> > >
> >
> >
>

Re: Insert blocked

Posted by Elliott Clark <ec...@stumbleupon.com>.
Thanks I hadn't seen that before

On Mon, Jul 23, 2012 at 10:29 PM, lars hofhansl <lh...@yahoo.com> wrote:

> Or you can pre-create your HConnection and Threadpool and use the HTable
> constructor that takes these as arguments.
> That is faster and less "byzantine" compared to the HTablePool "monster".
>
> Also see here (if you don't mind the plug):
> http://hadoop-hbase.blogspot.com/2011/12/long-running-hbase-clients.html
>
>
> -- Lars
>
>
>
> ----- Original Message -----
> From: Elliott Clark <ec...@stumbleupon.com>
> To: user@hbase.apache.org
> Cc:
> Sent: Monday, July 23, 2012 3:54 PM
> Subject: Re: Insert blocked
>
> HTable is not thread safe[1]. It's better to use HTablePool if you want to
> share things across multiple threads.[2]
>
> 1
> http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/HTable.html
> 2
>
> http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/HTablePool.html
>
> On Mon, Jul 23, 2012 at 3:48 PM, Mohit Anchlia <mohitanchlia@gmail.com
> >wrote:
>
> > I am writing a stress tool to test my specific use case. In my current
> > implementation HTable is a global static variable that I initialize just
> > once and use it accross multiple threads. Is this ok?
> >
> > My row key consists of (timestamp - (timestamp % 1000)) and cols are
> > counters. What I am seeing is that when I run my test after first row is
> > created the application just hangs. I just wanted to check if there are
> > obvious things that I should watch out for.
> >
> > I am currently testing few threads in eclipse, but I'll still try and
> > generate stackTrace
> >
>
>

Re: Insert blocked

Posted by lars hofhansl <lh...@yahoo.com>.
Or you can pre-create your HConnection and Threadpool and use the HTable constructor that takes these as arguments.
That is faster and less "byzantine" compared to the HTablePool "monster".

Also see here (if you don't mind the plug): http://hadoop-hbase.blogspot.com/2011/12/long-running-hbase-clients.html


-- Lars



----- Original Message -----
From: Elliott Clark <ec...@stumbleupon.com>
To: user@hbase.apache.org
Cc: 
Sent: Monday, July 23, 2012 3:54 PM
Subject: Re: Insert blocked

HTable is not thread safe[1]. It's better to use HTablePool if you want to
share things across multiple threads.[2]

1 http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/HTable.html
2
http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/HTablePool.html

On Mon, Jul 23, 2012 at 3:48 PM, Mohit Anchlia <mo...@gmail.com>wrote:

> I am writing a stress tool to test my specific use case. In my current
> implementation HTable is a global static variable that I initialize just
> once and use it accross multiple threads. Is this ok?
>
> My row key consists of (timestamp - (timestamp % 1000)) and cols are
> counters. What I am seeing is that when I run my test after first row is
> created the application just hangs. I just wanted to check if there are
> obvious things that I should watch out for.
>
> I am currently testing few threads in eclipse, but I'll still try and
> generate stackTrace
>


Re: Insert blocked

Posted by Asaf Mesika <as...@gmail.com>.
Is htable in autoFlush? What's your client buffer size?
What the thread stuck on? Take a thread dump

Sent from my iPad

On 24 ביול 2012, at 03:42, Mohit Anchlia <mo...@gmail.com> wrote:

> I am now using HTablePool but still the call hangs at "put". My code is
> something like this:
>
>
> hTablePool = *new* HTablePool(config,*MAX_POOL_SIZE*);
>
> result = *new* SessionTimelineDAO(hTablePool.getTable(t.name()),
> ColumnFamily.*S_T_MTX*);
>
> public SessionTimelineDAO(HTableInterface hTableInterface, ColumnFamily
> cf){
>  this.tableInt = hTableInterface;
>  this.cf = cf.name().getBytes();
>  log.info("Table " + hTableInterface + " " + cf);
> }
>
> @Override
> public void create(DataStoreModel dm) throws DataStoreException {
>  if(null == dm || null == dm.getKey()){
>   log.error("DataStoreModel is invalid");
>   return;
>  }
>
>  Put p = new Put(dm.getKey().array());
>
>  for(ByteBuffer bf : dm.getCols().keySet()){
>   p.add(cf, bf.array(), dm.getColumnValue(bf).array());
>  }
>
>  try {
>   log.info("In create ");
>   tableInt.put(p);
>  } catch (IOException e) {
>   log.error("Error writing " , e);
>   throw new DataStoreException(e);
>  } finally{
>   cleanUp();
>
>  }
> }
>
>
> private void cleanUp() {
>  if(null != tableInt){
>   try {
>    tableInt.close();
>   } catch (IOException e) {
>    log.error("Failed while closing table interface", e);
>   }
>  }
> }
> On Mon, Jul 23, 2012 at 4:15 PM, Mohit Anchlia <mo...@gmail.com>wrote:
>
>>
>>
>> On Mon, Jul 23, 2012 at 3:54 PM, Elliott Clark <ec...@stumbleupon.com>wrote:
>>
>>> HTable is not thread safe[1]. It's better to use HTablePool if you want to
>>> share things across multiple threads.[2]
>>>
>>> 1
>>> http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/HTable.html
>>> 2
>>>
>>> http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/HTablePool.html
>>>
>>> Thanks! I'll change my code to use HtablePool
>>
>>> On Mon, Jul 23, 2012 at 3:48 PM, Mohit Anchlia <mohitanchlia@gmail.com
>>>> wrote:
>>>
>>>> I am writing a stress tool to test my specific use case. In my current
>>>> implementation HTable is a global static variable that I initialize just
>>>> once and use it accross multiple threads. Is this ok?
>>>>
>>>> My row key consists of (timestamp - (timestamp % 1000)) and cols are
>>>> counters. What I am seeing is that when I run my test after first row is
>>>> created the application just hangs. I just wanted to check if there are
>>>> obvious things that I should watch out for.
>>>>
>>>> I am currently testing few threads in eclipse, but I'll still try and
>>>> generate stackTrace
>>>>
>>>
>>
>>

Re: Insert blocked

Posted by Mohit Anchlia <mo...@gmail.com>.
I removed the close call and it works. So it looks like close call should
be called only at the end. But then how does the pool know that the object
is available if it's not returned to the pool explicitly?

On Tue, Jul 24, 2012 at 10:00 AM, Mohit Anchlia <mo...@gmail.com>wrote:

>
>
>  On Tue, Jul 24, 2012 at 3:09 AM, Lyska Anton <an...@wildec.com> wrote:
>
>> Hi,
>>
>> after first insert you are closing your table in finally block. thats why
>> thread hangs
>>
>
> I thought I need to close HTableInterface to return it back to the pool.
> Is that not the case?
>
>>
>> 24.07.2012 3:41, Mohit Anchlia пишет:
>>
>>> I am now using HTablePool but still the call hangs at "put". My code is
>>> something like this:
>>>
>>>
>>> hTablePool = *new* HTablePool(config,*MAX_POOL_**SIZE*);
>>>
>>> result = *new* SessionTimelineDAO(hTablePool.**getTable(t.name()),
>>> ColumnFamily.*S_T_MTX*);
>>>
>>>    public SessionTimelineDAO(**HTableInterface hTableInterface,
>>> ColumnFamily
>>> cf){
>>>    this.tableInt = hTableInterface;
>>>    this.cf = cf.name().getBytes();
>>>    log.info("Table " + hTableInterface + " " + cf);
>>>   }
>>>
>>>   @Override
>>>   public void create(DataStoreModel dm) throws DataStoreException {
>>>    if(null == dm || null == dm.getKey()){
>>>     log.error("DataStoreModel is invalid");
>>>     return;
>>>    }
>>>
>>>    Put p = new Put(dm.getKey().array());
>>>
>>>    for(ByteBuffer bf : dm.getCols().keySet()){
>>>     p.add(cf, bf.array(), dm.getColumnValue(bf).array())**;
>>>    }
>>>
>>>    try {
>>>     log.info("In create ");
>>>     tableInt.put(p);
>>>    } catch (IOException e) {
>>>     log.error("Error writing " , e);
>>>     throw new DataStoreException(e);
>>>    } finally{
>>>     cleanUp();
>>>
>>>    }
>>>   }
>>>
>>>
>>>   private void cleanUp() {
>>>    if(null != tableInt){
>>>     try {
>>>      tableInt.close();
>>>     } catch (IOException e) {
>>>      log.error("Failed while closing table interface", e);
>>>     }
>>>    }
>>>   }
>>> On Mon, Jul 23, 2012 at 4:15 PM, Mohit Anchlia <mohitanchlia@gmail.com
>>> >wrote:
>>>
>>>
>>>>   On Mon, Jul 23, 2012 at 3:54 PM, Elliott Clark <
>>>> eclark@stumbleupon.com>wrote:
>>>>
>>>> HTable is not thread safe[1]. It's better to use HTablePool if you want
>>>>> to
>>>>> share things across multiple threads.[2]
>>>>>
>>>>> 1
>>>>> http://hbase.apache.org/**apidocs/org/apache/hadoop/**
>>>>> hbase/client/HTable.html<http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/HTable.html>
>>>>> 2
>>>>>
>>>>> http://hbase.apache.org/**apidocs/org/apache/hadoop/**
>>>>> hbase/client/HTablePool.html<http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/HTablePool.html>
>>>>>
>>>>> Thanks! I'll change my code to use HtablePool
>>>>> On Mon, Jul 23, 2012 at 3:48 PM, Mohit Anchlia <mohitanchlia@gmail.com
>>>>>
>>>>>> wrote:
>>>>>> I am writing a stress tool to test my specific use case. In my current
>>>>>> implementation HTable is a global static variable that I initialize
>>>>>> just
>>>>>> once and use it accross multiple threads. Is this ok?
>>>>>>
>>>>>> My row key consists of (timestamp - (timestamp % 1000)) and cols are
>>>>>> counters. What I am seeing is that when I run my test after first row
>>>>>> is
>>>>>> created the application just hangs. I just wanted to check if there
>>>>>> are
>>>>>> obvious things that I should watch out for.
>>>>>>
>>>>>> I am currently testing few threads in eclipse, but I'll still try and
>>>>>> generate stackTrace
>>>>>>
>>>>>>
>>>>
>>
>

Re: Insert blocked

Posted by Mohit Anchlia <mo...@gmail.com>.
On Tue, Jul 24, 2012 at 3:09 AM, Lyska Anton <an...@wildec.com> wrote:

> Hi,
>
> after first insert you are closing your table in finally block. thats why
> thread hangs
>

I thought I need to close HTableInterface to return it back to the pool. Is
that not the case?

>
> 24.07.2012 3:41, Mohit Anchlia пишет:
>
>> I am now using HTablePool but still the call hangs at "put". My code is
>> something like this:
>>
>>
>> hTablePool = *new* HTablePool(config,*MAX_POOL_**SIZE*);
>>
>> result = *new* SessionTimelineDAO(hTablePool.**getTable(t.name()),
>> ColumnFamily.*S_T_MTX*);
>>
>>    public SessionTimelineDAO(**HTableInterface hTableInterface,
>> ColumnFamily
>> cf){
>>    this.tableInt = hTableInterface;
>>    this.cf = cf.name().getBytes();
>>    log.info("Table " + hTableInterface + " " + cf);
>>   }
>>
>>   @Override
>>   public void create(DataStoreModel dm) throws DataStoreException {
>>    if(null == dm || null == dm.getKey()){
>>     log.error("DataStoreModel is invalid");
>>     return;
>>    }
>>
>>    Put p = new Put(dm.getKey().array());
>>
>>    for(ByteBuffer bf : dm.getCols().keySet()){
>>     p.add(cf, bf.array(), dm.getColumnValue(bf).array())**;
>>    }
>>
>>    try {
>>     log.info("In create ");
>>     tableInt.put(p);
>>    } catch (IOException e) {
>>     log.error("Error writing " , e);
>>     throw new DataStoreException(e);
>>    } finally{
>>     cleanUp();
>>
>>    }
>>   }
>>
>>
>>   private void cleanUp() {
>>    if(null != tableInt){
>>     try {
>>      tableInt.close();
>>     } catch (IOException e) {
>>      log.error("Failed while closing table interface", e);
>>     }
>>    }
>>   }
>> On Mon, Jul 23, 2012 at 4:15 PM, Mohit Anchlia <mohitanchlia@gmail.com
>> >wrote:
>>
>>
>>>   On Mon, Jul 23, 2012 at 3:54 PM, Elliott Clark <eclark@stumbleupon.com
>>> >wrote:
>>>
>>> HTable is not thread safe[1]. It's better to use HTablePool if you want
>>>> to
>>>> share things across multiple threads.[2]
>>>>
>>>> 1
>>>> http://hbase.apache.org/**apidocs/org/apache/hadoop/**
>>>> hbase/client/HTable.html<http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/HTable.html>
>>>> 2
>>>>
>>>> http://hbase.apache.org/**apidocs/org/apache/hadoop/**
>>>> hbase/client/HTablePool.html<http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/HTablePool.html>
>>>>
>>>> Thanks! I'll change my code to use HtablePool
>>>> On Mon, Jul 23, 2012 at 3:48 PM, Mohit Anchlia <mohitanchlia@gmail.com
>>>>
>>>>> wrote:
>>>>> I am writing a stress tool to test my specific use case. In my current
>>>>> implementation HTable is a global static variable that I initialize
>>>>> just
>>>>> once and use it accross multiple threads. Is this ok?
>>>>>
>>>>> My row key consists of (timestamp - (timestamp % 1000)) and cols are
>>>>> counters. What I am seeing is that when I run my test after first row
>>>>> is
>>>>> created the application just hangs. I just wanted to check if there are
>>>>> obvious things that I should watch out for.
>>>>>
>>>>> I am currently testing few threads in eclipse, but I'll still try and
>>>>> generate stackTrace
>>>>>
>>>>>
>>>
>

Re: Insert blocked

Posted by Lyska Anton <an...@wildec.com>.
Hi,

after first insert you are closing your table in finally block. thats why thread hangs

24.07.2012 3:41, Mohit Anchlia пишет:
> I am now using HTablePool but still the call hangs at "put". My code is
> something like this:
>
>
> hTablePool = *new* HTablePool(config,*MAX_POOL_SIZE*);
>
> result = *new* SessionTimelineDAO(hTablePool.getTable(t.name()),
> ColumnFamily.*S_T_MTX*);
>
>   public SessionTimelineDAO(HTableInterface hTableInterface, ColumnFamily
> cf){
>    this.tableInt = hTableInterface;
>    this.cf = cf.name().getBytes();
>    log.info("Table " + hTableInterface + " " + cf);
>   }
>
>   @Override
>   public void create(DataStoreModel dm) throws DataStoreException {
>    if(null == dm || null == dm.getKey()){
>     log.error("DataStoreModel is invalid");
>     return;
>    }
>
>    Put p = new Put(dm.getKey().array());
>
>    for(ByteBuffer bf : dm.getCols().keySet()){
>     p.add(cf, bf.array(), dm.getColumnValue(bf).array());
>    }
>
>    try {
>     log.info("In create ");
>     tableInt.put(p);
>    } catch (IOException e) {
>     log.error("Error writing " , e);
>     throw new DataStoreException(e);
>    } finally{
>     cleanUp();
>
>    }
>   }
>
>
>   private void cleanUp() {
>    if(null != tableInt){
>     try {
>      tableInt.close();
>     } catch (IOException e) {
>      log.error("Failed while closing table interface", e);
>     }
>    }
>   }
> On Mon, Jul 23, 2012 at 4:15 PM, Mohit Anchlia <mo...@gmail.com>wrote:
>
>>
>>   On Mon, Jul 23, 2012 at 3:54 PM, Elliott Clark <ec...@stumbleupon.com>wrote:
>>
>>> HTable is not thread safe[1]. It's better to use HTablePool if you want to
>>> share things across multiple threads.[2]
>>>
>>> 1
>>> http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/HTable.html
>>> 2
>>>
>>> http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/HTablePool.html
>>>
>>> Thanks! I'll change my code to use HtablePool
>>> On Mon, Jul 23, 2012 at 3:48 PM, Mohit Anchlia <mohitanchlia@gmail.com
>>>> wrote:
>>>> I am writing a stress tool to test my specific use case. In my current
>>>> implementation HTable is a global static variable that I initialize just
>>>> once and use it accross multiple threads. Is this ok?
>>>>
>>>> My row key consists of (timestamp - (timestamp % 1000)) and cols are
>>>> counters. What I am seeing is that when I run my test after first row is
>>>> created the application just hangs. I just wanted to check if there are
>>>> obvious things that I should watch out for.
>>>>
>>>> I am currently testing few threads in eclipse, but I'll still try and
>>>> generate stackTrace
>>>>
>>


Re: Insert blocked

Posted by Mohit Anchlia <mo...@gmail.com>.
I am now using HTablePool but still the call hangs at "put". My code is
something like this:


hTablePool = *new* HTablePool(config,*MAX_POOL_SIZE*);

result = *new* SessionTimelineDAO(hTablePool.getTable(t.name()),
ColumnFamily.*S_T_MTX*);

 public SessionTimelineDAO(HTableInterface hTableInterface, ColumnFamily
cf){
  this.tableInt = hTableInterface;
  this.cf = cf.name().getBytes();
  log.info("Table " + hTableInterface + " " + cf);
 }

 @Override
 public void create(DataStoreModel dm) throws DataStoreException {
  if(null == dm || null == dm.getKey()){
   log.error("DataStoreModel is invalid");
   return;
  }

  Put p = new Put(dm.getKey().array());

  for(ByteBuffer bf : dm.getCols().keySet()){
   p.add(cf, bf.array(), dm.getColumnValue(bf).array());
  }

  try {
   log.info("In create ");
   tableInt.put(p);
  } catch (IOException e) {
   log.error("Error writing " , e);
   throw new DataStoreException(e);
  } finally{
   cleanUp();

  }
 }


 private void cleanUp() {
  if(null != tableInt){
   try {
    tableInt.close();
   } catch (IOException e) {
    log.error("Failed while closing table interface", e);
   }
  }
 }
On Mon, Jul 23, 2012 at 4:15 PM, Mohit Anchlia <mo...@gmail.com>wrote:

>
>
>  On Mon, Jul 23, 2012 at 3:54 PM, Elliott Clark <ec...@stumbleupon.com>wrote:
>
>> HTable is not thread safe[1]. It's better to use HTablePool if you want to
>> share things across multiple threads.[2]
>>
>> 1
>> http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/HTable.html
>> 2
>>
>> http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/HTablePool.html
>>
>> Thanks! I'll change my code to use HtablePool
>
>> On Mon, Jul 23, 2012 at 3:48 PM, Mohit Anchlia <mohitanchlia@gmail.com
>> >wrote:
>>
>> > I am writing a stress tool to test my specific use case. In my current
>> > implementation HTable is a global static variable that I initialize just
>> > once and use it accross multiple threads. Is this ok?
>> >
>> > My row key consists of (timestamp - (timestamp % 1000)) and cols are
>> > counters. What I am seeing is that when I run my test after first row is
>> > created the application just hangs. I just wanted to check if there are
>> > obvious things that I should watch out for.
>> >
>> > I am currently testing few threads in eclipse, but I'll still try and
>> > generate stackTrace
>> >
>>
>
>

Re: Insert blocked

Posted by Mohit Anchlia <mo...@gmail.com>.
On Mon, Jul 23, 2012 at 3:54 PM, Elliott Clark <ec...@stumbleupon.com>wrote:

> HTable is not thread safe[1]. It's better to use HTablePool if you want to
> share things across multiple threads.[2]
>
> 1
> http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/HTable.html
> 2
>
> http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/HTablePool.html
>
> Thanks! I'll change my code to use HtablePool

> On Mon, Jul 23, 2012 at 3:48 PM, Mohit Anchlia <mohitanchlia@gmail.com
> >wrote:
>
> > I am writing a stress tool to test my specific use case. In my current
> > implementation HTable is a global static variable that I initialize just
> > once and use it accross multiple threads. Is this ok?
> >
> > My row key consists of (timestamp - (timestamp % 1000)) and cols are
> > counters. What I am seeing is that when I run my test after first row is
> > created the application just hangs. I just wanted to check if there are
> > obvious things that I should watch out for.
> >
> > I am currently testing few threads in eclipse, but I'll still try and
> > generate stackTrace
> >
>

Re: Insert blocked

Posted by Elliott Clark <ec...@stumbleupon.com>.
HTable is not thread safe[1]. It's better to use HTablePool if you want to
share things across multiple threads.[2]

1 http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/HTable.html
2
http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/HTablePool.html

On Mon, Jul 23, 2012 at 3:48 PM, Mohit Anchlia <mo...@gmail.com>wrote:

> I am writing a stress tool to test my specific use case. In my current
> implementation HTable is a global static variable that I initialize just
> once and use it accross multiple threads. Is this ok?
>
> My row key consists of (timestamp - (timestamp % 1000)) and cols are
> counters. What I am seeing is that when I run my test after first row is
> created the application just hangs. I just wanted to check if there are
> obvious things that I should watch out for.
>
> I am currently testing few threads in eclipse, but I'll still try and
> generate stackTrace
>