You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Andrew Purtell (JIRA)" <ji...@apache.org> on 2014/05/11 13:10:15 UTC
[jira] [Updated] (HBASE-7463) [REST] Use "unmanaged" HConnection
instead of HTablePool
[ https://issues.apache.org/jira/browse/HBASE-7463?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andrew Purtell updated HBASE-7463:
----------------------------------
Assignee: (was: Andrew Purtell)
> [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.95.2
> Reporter: Andrew Purtell
> Priority: Minor
>
> In a thread on user@ titled "Recovery from cluster wide failure", [~lhofhansl] wrote:
> {quote}
> 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.
> {quote}
--
This message was sent by Atlassian JIRA
(v6.2#6252)