扫描器缓存
----------------
    面向行级别的。
    @Test
    public void getScanCache() throws IOException {

        Configuration conf = HBaseConfiguration.create();
        Connection conn = ConnectionFactory.createConnection(conf);
        TableName tname = TableName.valueOf("ns1:t1");
        Scan scan = new Scan();
        scan.setCaching(5000);
        Table t = conn.getTable(tname);
        ResultScanner rs = t.getScanner(scan);
        long start = System.currentTimeMillis() ;
        Iterator<Result> it = rs.iterator();
        while(it.hasNext()){
            Result r = it.next();
            System.out.println(r.getColumnLatestCell(Bytes.toBytes("f1"), Bytes.toBytes("name")));
        }
        System.out.println(System.currentTimeMillis() - start);
    }
批量扫描是面向列级别
--------------------
    控制每次next()服务器端返回的列的个数。
    scan.setBatch(5);                //每次next返回5列。

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-25
  • 2022-12-23
  • 2021-07-24
  • 2022-12-23
  • 2022-12-23
  • 2021-07-08
猜你喜欢
  • 2022-12-23
  • 2021-06-12
  • 2021-11-23
  • 2021-04-13
  • 2021-07-12
相关资源
相似解决方案