我们在项目中使用hazelcast作为缓存数据库,使用hbase作为持久数据库解决方案。当应用程序启动时,我们使用maploader将数据从hbase加载到hazelcast。下面是loadall()函数的片段。
@Override
public synchronized Map<String, Object> loadAll(Collection<String> rows) {
final Map<String, Object> mapObject = new HashMap<String, Object>();
try {
if (!rows.isEmpty()) {
//Get Scanner from Hbase
final ResultScanner scanner = loadAllData(rows, this.mapName);
final byte[] family = this.mapName.getBytes();
final byte[] qualifier = this.mapName.getBytes();
//Load data from Hbase to Hazelcast
for (Result result = scanner.next(); result != null; result = scanner
.next()) {
mapObject
.put(Bytes.toString(result.getRow()),
convertToObject(result.getValue(family,
qualifier)));
}
LOGGER.logDebug(Constants.EXIT, methodName,
"All the data's are successfully loaded for Table "
+ this.mapName);
}
} catch (Exception e) {
throw new RuntimeException(e);
}
return mapObject;
}
我们有一个350k条目的表(总数据大小为300MB),加载数据需要将近1.5个小时。这是正常的行为吗?hazelcast通常需要这么长时间来加载数据吗?
暂无答案!
目前还没有任何答案,快来回答吧!