janusgraph加载记录期间提交性能低



当我试图从MySQL加载大量数据时,我使用cassandra后端和elasticsearch将每条记录提交到JanusGraph,用于构建索引,使用8线程

一开始,程序将以280条记录/秒的速度加载
但当它处理秒时,它会下降到每秒1到10条记录;

我尝试修改缓冲区大小页面大小lock大小更新百分比等配置,但没有明显改善;

我只是想知道我是否错过了什么,是什么导致了这种情况

下面的代码是我的提交过程,dataMap是一个fastJson对象,g则是一个janusgraph遍历源;

Long countryId = dataMap.getLong("countryId");
Long uid = dataMap.getLong("uid");
String phoneNum = dataMap.getString("phoneNumber");
String fbId = dataMap.getString("fbId");
Long createTime = dataMap.getLong("createTime");
if (uid == null) {
return;
}
Vertex uidVertex = g.addV("uid").next();
uidVertex.property("uid_code", uid);
if (createTime != null)
uidVertex.property("create_time", createTime);
if (status != null)
uidVertex.property("status", status);
g.tx().commit();
if (phoneNum != null) {
Vertex phoneVertex = KfkMsgParser.createMerge(g, "phone", "phone_num", phoneNum);
Edge selfPhone = uidVertex.addEdge("user_phone", phoneVertex);
selfPhone.property("create_time", bind.of("create_time", dataMap.getLong("createTime")));
selfPhone.property("uid_code", bind.of("uid_code", uid));
selfPhone.property("phone_num", bind.of("phone_num", phoneNum));
g.tx().commit();
}
if(fbId != null){
long endTamp2 = System.currentTimeMillis();
Vertex fbVertext = KfkMsgParser.createMerge(g, "fb_id", "fb_account",fbId);
Edge selfFb = uidVertex.addEdge("user_fb",fbVertext);
if (createTime != null)
selfFb.property("create_time",bind.of("create_time",createTime));
g.tx().commit();
}

以下是createMerge函数:

private static Vertex createMerge(GraphTraversalSource g, String label, String propertyKey, Object propertyValue) {
Optional<Vertex> vertexOptional = g.V().hasLabel(label).has(propertyKey, propertyValue).tryNext();
if (vertexOptional.isPresent()) {
return vertexOptional.get();
}
Vertex vertex = g.addV(label).next();
vertex.property(propertyKey, propertyValue);
return vertex;
}

构建索引时出错
我在谷歌群里找到这样一个话题:https://groups.google.com/forum/#!msg/janusgraph users/VPIUdlC4wNo/KiHM-s2aAwAJ
并且知道每秒获得2000到3000条记录。

最新更新