You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Vimal Jain <vk...@gmail.com> on 2013/08/10 14:04:52 UTC
maxSize parameter in HTablePool class
I am using HTablePool class in my client code to interact with Hbase. I see
many constructors for this class ,one of them is :
HTablePool(org.apache.hadoop.conf.Configuration config, int maxSize)
Can anyone please help in understanding the second parameter (maxSize).
--
Thanks and Regards,
Vimal Jain
Re: maxSize parameter in HTablePool class
Posted by Vimal Jain <vk...@gmail.com>.
Thanks a lot Jean-Marc and Ted.
Now its clear.
On Sat, Aug 10, 2013 at 6:52 PM, Ted Yu <yu...@gmail.com> wrote:
> Vimal:
> Please also take a look at HBASE-6580 which would be in the upcoming
> 0.94.11
>
> HTablePool class is being deprecated.
>
> Cheers
>
> On Sat, Aug 10, 2013 at 6:14 AM, Jean-Marc Spaggiari <
> jean-marc@spaggiari.org> wrote:
>
> > Hi Vimal,
> >
> > Here is, in the code, where this information is uses.
> >
> > private void returnTable(HTableInterface table) throws IOException {
> > // this is the old putTable method renamed and made private
> > String tableName = Bytes.toString(table.getTableName());
> > if (tables.size(tableName) >= maxSize) {
> > // release table instance since we're not reusing it
> > this.tables.remove(tableName, table);
> > this.tableFactory.releaseHTableInterface(table);
> > return;
> > }
> > tables.put(tableName, table);
> > }
> >
> > As you can see, this value is used to limit the maximum size of the pool
> > i.e. the maximum number of the same table that we keep in the pool.
> >
> > Let's say you have a pool for mytable with maxSize=10. If you open 12
> > tables, that will give you 12 tables. Byt if you close the 12 tables,
> only
> > 10 of them are going to stay on the pool. The remaining 2 are going to be
> > released.
> >
> > HTH
> >
> > JM
> >
> > 2013/8/10 Vimal Jain <vk...@gmail.com>
> >
> > > I am using HTablePool class in my client code to interact with Hbase. I
> > see
> > > many constructors for this class ,one of them is :
> > >
> > > HTablePool(org.apache.hadoop.conf.Configuration config, int maxSize)
> > >
> > > Can anyone please help in understanding the second parameter (maxSize).
> > >
> > > --
> > > Thanks and Regards,
> > > Vimal Jain
> > >
> >
>
--
Thanks and Regards,
Vimal Jain
Re: maxSize parameter in HTablePool class
Posted by Ted Yu <yu...@gmail.com>.
Vimal:
Please also take a look at HBASE-6580 which would be in the upcoming 0.94.11
HTablePool class is being deprecated.
Cheers
On Sat, Aug 10, 2013 at 6:14 AM, Jean-Marc Spaggiari <
jean-marc@spaggiari.org> wrote:
> Hi Vimal,
>
> Here is, in the code, where this information is uses.
>
> private void returnTable(HTableInterface table) throws IOException {
> // this is the old putTable method renamed and made private
> String tableName = Bytes.toString(table.getTableName());
> if (tables.size(tableName) >= maxSize) {
> // release table instance since we're not reusing it
> this.tables.remove(tableName, table);
> this.tableFactory.releaseHTableInterface(table);
> return;
> }
> tables.put(tableName, table);
> }
>
> As you can see, this value is used to limit the maximum size of the pool
> i.e. the maximum number of the same table that we keep in the pool.
>
> Let's say you have a pool for mytable with maxSize=10. If you open 12
> tables, that will give you 12 tables. Byt if you close the 12 tables, only
> 10 of them are going to stay on the pool. The remaining 2 are going to be
> released.
>
> HTH
>
> JM
>
> 2013/8/10 Vimal Jain <vk...@gmail.com>
>
> > I am using HTablePool class in my client code to interact with Hbase. I
> see
> > many constructors for this class ,one of them is :
> >
> > HTablePool(org.apache.hadoop.conf.Configuration config, int maxSize)
> >
> > Can anyone please help in understanding the second parameter (maxSize).
> >
> > --
> > Thanks and Regards,
> > Vimal Jain
> >
>
Re: maxSize parameter in HTablePool class
Posted by Jean-Marc Spaggiari <je...@spaggiari.org>.
Hi Vimal,
Here is, in the code, where this information is uses.
private void returnTable(HTableInterface table) throws IOException {
// this is the old putTable method renamed and made private
String tableName = Bytes.toString(table.getTableName());
if (tables.size(tableName) >= maxSize) {
// release table instance since we're not reusing it
this.tables.remove(tableName, table);
this.tableFactory.releaseHTableInterface(table);
return;
}
tables.put(tableName, table);
}
As you can see, this value is used to limit the maximum size of the pool
i.e. the maximum number of the same table that we keep in the pool.
Let's say you have a pool for mytable with maxSize=10. If you open 12
tables, that will give you 12 tables. Byt if you close the 12 tables, only
10 of them are going to stay on the pool. The remaining 2 are going to be
released.
HTH
JM
2013/8/10 Vimal Jain <vk...@gmail.com>
> I am using HTablePool class in my client code to interact with Hbase. I see
> many constructors for this class ,one of them is :
>
> HTablePool(org.apache.hadoop.conf.Configuration config, int maxSize)
>
> Can anyone please help in understanding the second parameter (maxSize).
>
> --
> Thanks and Regards,
> Vimal Jain
>