hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yu Li <car...@gmail.com>
Subject Re: Question about open table
Date Mon, 11 Apr 2016 04:04:46 GMT
If using HBase 1.x, please make sure to reuse the connection since creating
connection is expensive. More specified, don't call
{{ConnectionFactory.createConnection}} (the 1.x recommended way) multiple
times but only once and share it among threads, while
{{HConnectionManager#getConnection}} (the <=0.98 way) would just be ok. FYI.

Best Regards,
Yu

On 10 April 2016 at 14:08, Yi Jiang <yi.jiang@ubisoft.com> wrote:

> Hi, Ted
> Thanks for help. The getConnection is just a simple getter method.public
> Connection getConnection(){return connection;} I have configured my
> connection in constructor.
> Jacky
>
> -----Original Message-----
> From: Ted Yu [mailto:yuzhihong@gmail.com]
> Sent: Saturday, April 09, 2016 11:03 AM
> To: user@hbase.apache.org
> Subject: Re: Question about open table
>
> Can you show the body of getConnection() ?
>
> getTable() itself is not expensive - assuming the same underlying
> Connection.
>
> Cheers
>
> On Sat, Apr 9, 2016 at 7:18 AM, Yi Jiang <yi.jiang@ubisoft.com> wrote:
>
> > Hi, Guys
> > I just have a question, I am trying to save the data into table in
> > HBase I am using
> >
> > Table table = getConnection().getTable(TableName.valueOf(tableName));
> > ...
> > ...
> > Table.close
> >
> > My question is that, is the "getTable" expensive?
> > Shall I use that get table and close table in each saving?
> > Or I just get table at the beginning, saving all data and then close
> > the table after all saving.
> > Because from the aspect of code design, I will save data into the
> > different table on the flying. So, if it is expensive, I would like to
> > rewrite the design.
> > Thank you
> > Jacky
> >
>

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