Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-7463

[REST] Use "unmanaged" HConnection instead of HTablePool

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Later
    • Affects Version/s: 0.95.2
    • Fix Version/s: None
    • Component/s: REST
    • Labels:
      None

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                apurtell Andrew Kyle Purtell
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: