hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Serega Sheypak <serega.shey...@gmail.com>
Subject Re: Connection pool Concurrency in HBase
Date Sun, 17 Aug 2014 19:36:26 GMT
It doesn't work.
I do get in logs:
23:15:27,579 [http-8080-1-SendThread(zookeeper-02.my.ru:2181)] DEBUG Got
ping response for sessionid: 0x246b06d6b0ae108 after 0ms
And tha's all I don't get exceptions and response. I use GET operation, no
scans or heavy stuff like that.



2014-08-04 22:09 GMT+04:00 Serega Sheypak <serega.sheypak@gmail.com>:

> Thanks, I'll read and inspect.
>
>
> 2014-08-04 21:52 GMT+04:00 anil gupta <anilgupta84@gmail.com>:
>
> Hi Serega,
>>
>> We have been using this constructor in HBase0.94:
>>
>> https://hbase.apache.org/0.94/apidocs/org/apache/hadoop/hbase/client/HTable.html#HTable%28byte[],%20org.apache.hadoop.hbase.client.HConnection,%20java.util.concurrent.ExecutorService%29
>>
>> This constructor is pretty light weight. But, you will need to manage
>> ExecutorService and HConnection by yourself. We create these in our
>> context
>> at startup and keep on reusing.
>> We use this in our web services and we call the HTable constructor for
>> every request separately so you will not run into threading issue.
>> NOTE: I havent tested this constructor for doing Writes through
>> webservices. We have using this for reads.
>>
>> HTH,
>> Anil Gupta
>>
>>
>>
>> On Mon, Aug 4, 2014 at 10:44 AM, Serega Sheypak <serega.sheypak@gmail.com
>> >
>> wrote:
>>
>> > Hi, I'm trying to understand how does connection pooling works in HBase.
>> > I've seen that
>> >
>> >
>> https://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/HConnectionManager.html
>> > is recommended to use.
>> >
>> > I have a servlet, it's instance shaed among many threads.
>> > What is a good way to use connection pooling in this case?
>> >
>> > Is this
>> >
>> > HConnection connection = HConnectionManager.createConnection(config);
>> >  HTableInterface table = connection.getTable("table1");
>> >  try {
>> >    // Use the table as needed, for a single operation and a single
>> thread
>> >  } finally {
>> >    table.close();
>> >    connection.close();
>> >  }
>> >
>> >
>> > 1. enough to reuse connection and they wouldn't be opened each time?
>> > 2. why do I have to close ALL: table and connection? It's done by
>> design?
>> >
>>
>>
>>
>> --
>> Thanks & Regards,
>> Anil Gupta
>>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message