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 Mon, 18 Aug 2014 13:07:09 GMT
I do get 1..100 cells using key+family+qualifier in single request.
then I serialize HBase result to json using my domain model and send it to
browser.
General idea is to reuse connections and do not repeat full connection
path: quorum, root, meta, RS with data for each servlet request. HBase
client with connection can cache it. That is why I think that
HConnectionManager can help me reuse connection in concurrency


2014-08-18 15:53 GMT+04:00 Mingtao Zhang <mail2mingtao@gmail.com>:

> Hi Serega,
>
> What's your purpose related to connection pool in doGet?
>
> Mingtao Sent from iPhone
>
> > On Aug 18, 2014, at 4:49 AM, Serega Sheypak <serega.sheypak@gmail.com>
> wrote:
> >
> > I have several servlets https://en.wikipedia.org/wiki/Java_Servlet.
> > Servlet have a lifecycle: it's " public void init(...)" method called
> only
> > once during container startup. Servlet has SINGLE instance shared among
> > many web-threads.
> > I want to init connection pool in servlet init method and then use this
> > pool in doGet method of servlet.
> >
> >
> >
> > 2014-08-18 5:13 GMT+04:00 Mingtao Zhang <mail2mingtao@gmail.com>:
> >
> >> We may need to know what you are planning to do with the connection pool
> >> to help.
> >>
> >> Mingtao Sent from iPhone
> >>
> >>>> On Aug 4, 2014, at 1:44 PM, 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?
> >>
>

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