hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Purtell (JIRA)" <j...@apache.org>
Subject [jira] [Created] (HBASE-7463) [REST] Use "unmanaged" HConnection instead of HTablePool
Date Sun, 30 Dec 2012 23:36:12 GMT
Andrew Purtell created HBASE-7463:

             Summary: [REST] Use "unmanaged" HConnection instead of HTablePool
                 Key: HBASE-7463
                 URL: https://issues.apache.org/jira/browse/HBASE-7463
             Project: HBase
          Issue Type: Improvement
          Components: REST
    Affects Versions: 0.96.0
            Reporter: Andrew Purtell
            Assignee: Andrew Purtell
            Priority: Minor

In a thread on user@ titled "Recovery from cluster wide failure", [~lhofhansl] wrote:
To survive cluster failures and get the best performance do this:

1. Create the HConnection yourself. HConnectionManager.createConnection(...). This gives you
an "unmanaged" connection, which represents a cluster. You need to remember to close it eventually.

2. Create a single ExecutorService.

3. Now, when you need to perform an operation create an HTable using the HTable(byte[]. HConnection,
ExecutorService) constructor, perform the operation, then close it and throw it away (close
is actually a noop in this case, but it should still be called). This constructor is extremely
cheap (assuming your HConnection has cached the region locations for the table already).

I added this code precisely because of the fact that a client can possibly outlive the cluster
it connects to and because creating a new HTable this way each time is actually faster than
retrieving from and returning to the HTablePool; and because lastly the caller controls things
rather than a Byzantine caching of HTable in HTablePool.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

View raw message