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: Re: managing HConnection
Date Fri, 13 Feb 2015 08:57:34 GMT
Hi, really, I can share one Hconnection for the whole application.
It's done by design. I have several servlets. Each servlet has 1-2
controllers working with hbase internally (put/get/e.t.c)
Right now I don't see any reason to refactor code and share single
HConnection for all controllers in servlets.


2015-02-13 6:56 GMT+03:00 David chen <c77_cn@163.com>:

> Hi Serega,
> I am very interesting in the reason why per application need to create 5
> instead of only one HConnection instances during servlet initialization?
>
>
>
>
>
>
>
>
> At 2015-02-04 01:01:38, "Serega Sheypak" <serega.sheypak@gmail.com> wrote:
> >Hi, guys from group helped me a lot. I did solve pretty the same problem
> >(CRUD web-app)
> >
> >1. Use single instance of HConnection per application.
> >2. Instantiate it once.
> >3. create HTable instance for each CRUD operation and safely close it
> >(try-catch-finally). Use the same HConnection to create any HTable for
> CRUD
> >operation.
> >4. DO NOT close HConnection after CRUD operation
> >
> >I have logic controllers which get HConnection injection in
> >HttpServlet.init method.
> >So I have 5 HConnection instances per application created during servlet
> >initialization
> >
> >
> >2015-02-03 18:12 GMT+03:00 Ted Yu <yuzhihong@gmail.com>:
> >
> >> Please see '61.1. Cluster Connections' under
> >> http://hbase.apache.org/book.html#architecture.client
> >>
> >> Cheers
> >>
> >> On Tue, Feb 3, 2015 at 6:47 AM, sleimanjneidi <jneidi.sleiman@gmail.com
> >
> >> wrote:
> >>
> >> > Hi all,
> >> > I am using hbase-0.98.1-cdh5.1.4 client and I am a bit confused by the
> >> > documentation of HConnection. The document says the following:
> >> >
> >> > HConnection instances can be shared. Sharing is usually what you want
> >> > because rather than each HConnection instance having to do its own
> >> > discovery of regions out on the cluster, instead, all clients get to
> >> share
> >> > the one cache of locations. HConnectionManager does the sharing for
> you
> >> if
> >> > you go by it getting connections. Sharing makes cleanup of
> HConnections
> >> > awkward. .
> >> >
> >> > So now I have a simple question: Can I share the same HConnection
> >> instance
> >> > in my entire application?
> >> > And write some magic code to know when to close or never close at all?
> >> > Or I have to create an instance and close it every time I do a CRUD
> >> > operation ?
> >> >
> >> > Many thanks
> >> >
> >> >
> >> >
> >>
>

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