Closed youngkangrui closed 2 years ago
我更换到这段代码后,cpu正常,由于我使用hbase存储,hbase的随机写要快于随机读,所以要将读替换成写
sourceVertex = hugeGraph.addVertex(T.label,sourceLabel,sourceKey, sourceValue);
targetVertex = hugeGraph.addVertex(T.label,targetLabel,targetKey,targetValue);
sourceVertex.addEdge(edgeLabel,targetVertex);
hugeGraph.tx().commit();
@youngkangrui 感谢详细的反馈。是的,防止产生随机读是性能优化的关键点。
另外,如果CPU过高时,可以调小缓存大小降低gc压力,比如:
vertex.cache_capacity=10000
edge.cache_capacity=1000
@youngkangrui 大佬你好 程序之前使用gremlin语法查询单个点耗时比较长
2020-03-12 16:15:37 180082579 [gremlin-server-exec-15] [WARN ] org.apache.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine [] - Script compilation g.V().has("eid","e66c7ce822a9ab65f687ab9ef2116b8b") took 12301ms
现在想换成hugeGraph.traversal().V(),看大佬你也是这么操作的,但在操作的时候遇到一点问题不知道怎么搞,就是使用hugegraph-api中hugegraph时,不知道具体参数需要传什么,麻烦大佬帮忙解答一下或者方便的话贴一下大佬你操作hugegraph这块代码参考一下,非常感谢。hugegraph代码如下:
HugeConfig hugeConfig = new HugeConfig(configuration); GraphManager graphManager = new GraphManager(); HugeGraph hugeGraph = graphManager.graph("graph");
@youngkangrui 大佬你好 程序之前使用gremlin语法查询单个点耗时比较长
2020-03-12 16:15:37 180082579 [gremlin-server-exec-15] [WARN ] org.apache.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine [] - Script compilation g.V().has("eid","e66c7ce822a9ab65f687ab9ef2116b8b") took 12301ms
现在想换成hugeGraph.traversal().V(),看大佬你也是这么操作的,但在操作的时候遇到一点问题不知道怎么搞,就是使用hugegraph-api中hugegraph时,不知道具体参数需要传什么,麻烦大佬帮忙解答一下或者方便的话贴一下大佬你操作hugegraph这块代码参考一下,非常感谢。hugegraph代码如下:
HugeConfig hugeConfig = new HugeConfig(configuration); GraphManager graphManager = new GraphManager(); HugeGraph hugeGraph = graphManager.graph("graph");
单点查询时间过长的问题没有遇到过,操作hugeGraph的代码如下
OptionSpace.register("hbase",
"com.baidu.hugegraph.backend.store.hbase.HbaseOptions");
SerializerFactory.register("hbase",
"com.baidu.hugegraph.backend.store.hbase.HbaseSerializer");
BackendProviderFactory.register("hbase",
"com.baidu.hugegraph.backend.store.hbase.HbaseStoreProvider");
PropertiesConfiguration conf = new PropertiesConfiguration();
conf.setDelimiterParsingDisabled(true);
conf.setProperty("backend","hbase");
conf.setProperty("serializer","hbase");
conf.setProperty("hbase.hosts", "192.169.45.10");
conf.setProperty("hbase.port","2181");
conf.setProperty("hbase.znode_parent","/hbase");
conf.setProperty("store","hugegraph");
conf.setProperty("store.graph",tableName);
HugeGraph hugeGraph = HugeFactory.open(conf);
hugeGraph.initBackend();
Due to the lack of activity, the current issue is marked as stale and will be closed after 20 days, any update will remove the stale label
cpu飙高期间的stack信息中,最主要的cpu消耗是下面线程的内容:
主要业务功能是先查询节点,在节点之间加入边,对应代码中的是