在我的应用程序中,我正在hbase中扫描一个表,以获取要在ui上显示的数据。数据量巨大,代码给出以下错误。提供的服务器配置为:server-xms2048m-xmx4096m
"Failure in caller transaction.: java.lang.OutOfMemoryError: Java heap space"
代码:
HTable table = null;
try {
Configuration config = HBaseConfiguration.create();
config.set("hbase.zookeeper.quorum", hbaseServer);
config.set("hbase.zookeeper.property.clientPort", hbasePort);
FilterList list = new FilterList(FilterList.Operator.MUST_PASS_ALL);
table = new HTable(config, "tableName");
SingleColumnValueFilter filter = new SingleColumnValueFilter(Bytes.toBytes(filterName),
Bytes.toBytes(filterName), CompareFilter.CompareOp.EQUAL, new BinaryComparator(Bytes.toBytes (String.valueOf(filterValue))));
list.addFilter(filter);
Scan scan = new Scan();
scan.setFilter(list);
scanner = table.getScanner(scan);
如果我添加以下过滤器以减少记录数,则数据呈现时不会出错:
scan.setFilter(new PageFilter(100));
但是,如果我在eclipse中使用内存分析器工具提取堆转储,那么不管从hbase获取的记录数是多少,堆转储的大小都是相同的。我还添加了下面的代码,以避免缓存,但结果同样没有变化。
scan.setCaching(0);
scan.setCacheBlocks(false);
这是否意味着生成的堆转储不依赖于要获取的数据量?我做错什么了吗?
暂无答案!
目前还没有任何答案,快来回答吧!