does hbase scan doubts

2016-03-13 Thread Shushant Arora
Does hbase scan or get is single threaded?
Say I have hbase table with 100 regionservers.

When I scan a key rangle say a-z(distributed on all regionservers), will
the client make calls to regionservers in parallel all at once or one by
one.First it will get all keys from one regionserver then make a next call
to another regionserver in lexicographic order of keys?

If it makes call in parallel then how does it ensure result to be sorted by
key always?

Thanks!


Re: use of hbase client in application server

2016-03-13 Thread Shushant Arora
2.DO I need to check whether Hconnection is still active before using it to
create Htable instance.

By still valid I meant that say I created Hconnection object and after 3-4
minutes when request came for any crud operation for some table and before
getting Htable using from
HConnection say Hconnection object or TCP/IP connection to cluster dropped.
Does now if I create Htable using HConnection will it recrete the TCP
connection to cluster automatically?

1.And will increasing no of HConnectoions will improve the performance?

Thanks!

On Sun, Mar 13, 2016 at 7:47 PM, Ted Yu  wrote:

> For #1, single Hconnection should work.
>
> For #2, can you clarify ? As long as the hbase-site.xml used to create
> the Hconnection
> is still valid, you can continue using the connection.
>
> For #3, they're handled by the connection automatically.
>
> For #4, the HTable ctor you cited doesn't exist in master branch.
> You can control the following parameters for the ThreadPoolExecutor - see
> HTable#getDefaultExecutor():
>
> int maxThreads = conf.getInt("hbase.htable.threads.max", Integer.
> MAX_VALUE);
>
> if (maxThreads == 0) {
>
>   maxThreads = 1; // is there a better default?
>
> }
>
> int corePoolSize = conf.getInt("hbase.htable.threads.coresize", 1);
>
> long keepAliveTime = conf.getLong("hbase.htable.threads.keepalivetime",
> 60);
>
> On Sun, Mar 13, 2016 at 3:12 AM, Shushant Arora  >
> wrote:
>
> > I have a requirement to use long running hbase client in application
> > server.
> >
> > 1.Do I need to create multiple HConnections or single Hconnection will
> > work?
> > 2. DO I need to check whether Hconnection is still active before using it
> > to create Htable instance.
> > 3.DO I need to handle region split and regionserver changes while using
> > Hconnection or are they handled automatically.
> > 4.Whats the use of thread pool in Htable instance.
> > ExecutorService threadPool;
> > HTable h = new HTable(conf, Bytes.toBytes("tablename"), threadPool);
> >
> >
> > Thanks!
> >
>


Re: use of hbase client in application server

2016-03-13 Thread Ted Yu
For #1, single Hconnection should work.

For #2, can you clarify ? As long as the hbase-site.xml used to create
the Hconnection
is still valid, you can continue using the connection.

For #3, they're handled by the connection automatically.

For #4, the HTable ctor you cited doesn't exist in master branch.
You can control the following parameters for the ThreadPoolExecutor - see
HTable#getDefaultExecutor():

int maxThreads = conf.getInt("hbase.htable.threads.max", Integer.
MAX_VALUE);

if (maxThreads == 0) {

  maxThreads = 1; // is there a better default?

}

int corePoolSize = conf.getInt("hbase.htable.threads.coresize", 1);

long keepAliveTime = conf.getLong("hbase.htable.threads.keepalivetime",
60);

On Sun, Mar 13, 2016 at 3:12 AM, Shushant Arora 
wrote:

> I have a requirement to use long running hbase client in application
> server.
>
> 1.Do I need to create multiple HConnections or single Hconnection will
> work?
> 2. DO I need to check whether Hconnection is still active before using it
> to create Htable instance.
> 3.DO I need to handle region split and regionserver changes while using
> Hconnection or are they handled automatically.
> 4.Whats the use of thread pool in Htable instance.
> ExecutorService threadPool;
> HTable h = new HTable(conf, Bytes.toBytes("tablename"), threadPool);
>
>
> Thanks!
>


use of hbase client in application server

2016-03-13 Thread Shushant Arora
I have a requirement to use long running hbase client in application server.

1.Do I need to create multiple HConnections or single Hconnection will work?
2. DO I need to check whether Hconnection is still active before using it
to create Htable instance.
3.DO I need to handle region split and regionserver changes while using
Hconnection or are they handled automatically.
4.Whats the use of thread pool in Htable instance.
ExecutorService threadPool;
HTable h = new HTable(conf, Bytes.toBytes("tablename"), threadPool);


Thanks!