Search code examples
javaperformancehadoophbasebatch-processing

HBase read : To improve on performance , how to do batch processing of get request using hbase java REST api


I am new to HBase REST API and was trying to find a way, that I could get a set of results for a set of Id's I would be doing a with a get command. As batch processing would help improve the performance of my code, instead of making a get request for each id for a table.

Some example Hbase java rest api code would be helpful.

thanks, in advance.


Solution

  • You should able to achieve it using scanner (HBase search API). Below e.g.

    Scan scan = new Scan();
    scan.setTimeRange( lowerBound, upperBound );
    
     Call it for each Column
    scan.addColumn //
    
    scan.setCaching( 1000 ) // how many rows for caching that will be passed to scanners.
    ResultScanner scanner = table.getScanner( scan );
    Iterator< Result > iterator = scanner.iterator();
    

    There are plenty of articles available to get more detail e.g. https://www.cloudera.com/documentation/enterprise/5-4-x/topics/admin_hbase_scanning.html