Cassandra janusgraph加载记录期间提交性能低
当我尝试从MySQL加载大量数据时, 我使用cassandra后端和elasticsearch将所有记录提交到JanusGraph,使用8个线程创建索引 开始时,程序将以每秒280条记录的速度加载; 但当它处理秒数时,它下降到1~10条记录/秒 我尝试修改缓冲区大小、页面大小、块大小、更新百分比等配置,但没有明显改善 我只是想知道我是否错过了什么,是什么导致了这种情况 下面的代码是我的提交过程,dataMap是一个fastJson对象,g是一个janusgraph遍历源代码Cassandra janusgraph加载记录期间提交性能低,cassandra,tinkerpop,janusgraph,Cassandra,Tinkerpop,Janusgraph,当我尝试从MySQL加载大量数据时, 我使用cassandra后端和elasticsearch将所有记录提交到JanusGraph,使用8个线程创建索引 开始时,程序将以每秒280条记录的速度加载; 但当它处理秒数时,它下降到1~10条记录/秒 我尝试修改缓冲区大小、页面大小、块大小、更新百分比等配置,但没有明显改善 我只是想知道我是否错过了什么,是什么导致了这种情况 下面的代码是我的提交过程,dataMap是一个fastJson对象,g是一个janusgraph遍历源代码 Long c
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;
}
我在建立索引时出错了。 我在谷歌集团中发现了这样一个话题: 并且知道每秒可以获得2000~3000条记录