Closed forgive2077 closed 3 years ago
@forgive2077 大概率可能是gremlin语句导致内存耗尽。请提供更多的日志信息,以及gremlin语句是什么样的?
这是查询语句,想要查询 TOP5 个边数最多的点 { "gremlin": "g.V().hasLabel('Entity').where(bothE().count().is(lte(g.V().hasLabel('Entity').map(bothE().count()).max()[0]))).order().by(bothE().count()).tail(5).toList()", "bindings": {}, "language": "gremlin-groovy", "aliases": {} }
报错日志 java.lang.IllegalStateException: javax.script.ScriptException: com.baidu.hugegraph.backend.BackendException: Interrupted, maybe it is timed out at com.baidu.hugegraph.traversal.optimize.HugeScriptTraversal.applyStrategies(HugeScriptTraversal.java:110)~[hugegraph-core-0.10.4.jar:0.10.4.0] at org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversal.hasNext(DefaultTraversal.java:196) ~[gremlin-core-3.4.3.jar:3.4.3] at com.baidu.hugegraph.api.job.GremlinAPI$GremlinJob.execute(GremlinAPI.java:119) ~[hugegraph-api-0.10.4.jar:0.48.0.0] at com.baidu.hugegraph.job.Job.call(Job.java:40) ~[hugegraph-core-0.10.4.jar:0.10.4.0] at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_192] at com.baidu.hugegraph.task.HugeTask.run(HugeTask.java:203) [hugegraph-core-0.10.4.jar:0.10.4.0] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_192] at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_192] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_192] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_192] at java.lang.Thread.run(Thread.java:748) [?:1.8.0_192] Caused by: javax.script.ScriptException: javax.script.ScriptException: com.baidu.hugegraph.backend.BackendException: Interrupted, maybe it is timed out at org.apache.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine.eval(GremlinGroovyScriptEngine.java:378) ~[gremlin-groovy-3.4.3.jar:3.4.3] at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:233) ~[?:1.8.0_192] at com.baidu.hugegraph.traversal.optimize.HugeScriptTraversal.applyStrategies(HugeScriptTraversal.java:97) ~[hugegraph-core-0.10.4.jar:0.10.4.0] ... 10 more Caused by: javax.script.ScriptException: com.baidu.hugegraph.backend.BackendException: Interrupted, maybe it is timed out at org.apache.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine.eval(GremlinGroovyScriptEngine.java:697) ~[gremlin-groovy-3.4.3.jar:3.4.3] at org.apache.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine.eval(GremlinGroovyScriptEngine.java:376) ~[gremlin-groovy-3.4.3.jar:3.4.3] at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:233) ~[?:1.8.0_192] at com.baidu.hugegraph.traversal.optimize.HugeScriptTraversal.applyStrategies(HugeScriptTraversal.java:97) ~[hugegraph-core-0.10.4.jar:0.10.4.0] ... 10 more Caused by: com.baidu.hugegraph.backend.BackendException: Interrupted, maybe it is timed out at com.baidu.hugegraph.backend.store.BackendEntryIterator.checkInterrupted(BackendEntryIterator.java:118) ~[hugegraph-core-0.10.4.jar:0.10.4.0] at com.baidu.hugegraph.backend.store.BackendEntryIterator.reachLimit(BackendEntryIterator.java:112) ~[hugegraph-core-0.10.4.jar:0.10.4.0] at com.baidu.hugegraph.backend.store.BackendEntryIterator.reachLimit(BackendEntryIterator.java:108) ~[hugegraph-core-0.10.4.jar:0.10.4.0] at com.baidu.hugegraph.backend.store.BackendEntryIterator.hasNext(BackendEntryIterator.java:52) ~[hugegraph-core-0.10.4.jar:0.10.4.0] at com.baidu.hugegraph.backend.tx.GraphIndexTransaction.doIndexQueryOnce(GraphIndexTransaction.java:514) ~[hugegraph-core-0.10.4.jar:0.10.4.0] at com.baidu.hugegraph.backend.tx.GraphIndexTransaction.doIndexQuery(GraphIndexTransaction.java:495) ~[hugegraph-core-0.10.4.jar:0.10.4.0] at com.baidu.hugegraph.backend.tx.GraphIndexTransaction.queryByLabel(GraphIndexTransaction.java:392) ~[hugegraph-core-0.10.4.jar:0.10.4.0] at com.baidu.hugegraph.backend.tx.GraphIndexTransaction.queryIndex(GraphIndexTransaction.java:350) ~[hugegraph-core-0.10.4.jar:0.10.4.0] at com.baidu.hugegraph.backend.tx.GraphTransaction.indexQuery(GraphTransaction.java:1114) ~[hugegraph-core-0.10.4.jar:0.10.4.0] at com.baidu.hugegraph.backend.tx.GraphTransaction.query(GraphTransaction.java:404) ~[hugegraph-core-0.10.4.jar:0.10.4.0] at com.baidu.hugegraph.backend.tx.GraphTransaction.queryVerticesFromBackend(GraphTransaction.java:592) ~[hugegraph-core-0.10.4.jar:0.10.4.0] at com.baidu.hugegraph.backend.cache.CachedGraphTransaction.queryVerticesFromBackend(CachedGraphTransaction.java:150) ~[hugegraph-core-0.10.4.jar:0.10.4.0] at com.baidu.hugegraph.backend.tx.GraphTransaction.queryVertices(GraphTransaction.java:561) ~[hugegraph-core-0.10.4.jar:0.10.4.0] at com.baidu.hugegraph.HugeGraph.vertices(HugeGraph.java:411) ~[hugegraph-core-0.10.4.jar:0.10.4.0] at com.baidu.hugegraph.traversal.optimize.HugeGraphStep.vertices(HugeGraphStep.java:99) ~[hugegraph-core-0.10.4.jar:0.10.4.0] at com.baidu.hugegraph.traversal.optimize.HugeGraphStep.lambda$new$0(HugeGraphStep.java:67) ~[hugegraph-core-0.10.4.jar:0.10.4.0] at org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep.processNextStart(GraphStep.java:155) ~[gremlin-core-3.4.3.jar:3.4.3] at org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.hasNext(AbstractStep.java:143) ~[gremlin-core-3.4.3.jar:3.4.3] at org.apache.tinkerpop.gremlin.process.traversal.step.util.ExpandableStepIterator.next(ExpandableStepIterator.java:50) ~[gremlin-core-3.4.3.jar:3.4.3] at org.apache.tinkerpop.gremlin.process.traversal.step.map.MapStep.processNextStart(MapStep.java:36) ~[gremlin-core-3.4.3.jar:3.4.3] at org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.hasNext(AbstractStep.java:143) ~[gremlin-core-3.4.3.jar:3.4.3] at org.apache.tinkerpop.gremlin.process.traversal.step.util.ExpandableStepIterator.hasNext(ExpandableStepIterator.java:42) ~[gremlin-core-3.4.3.jar:3.4.3] at org.apache.tinkerpop.gremlin.process.traversal.step.map.MaxGlobalStep.processAllStarts(MaxGlobalStep.java:45) ~[gremlin-core-3.4.3.jar:3.4.3] at org.apache.tinkerpop.gremlin.process.traversal.step.util.ReducingBarrierStep.processNextStart(ReducingBarrierStep.java:112) ~[gremlin-core-3.4.3.jar:3.4.3] at org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.hasNext(AbstractStep.java:143) ~[gremlin-core-3.4.3.jar:3.4.3] at org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversal.hasNext(DefaultTraversal.java:197) ~[gremlin-core-3.4.3.jar:3.4.3] at org.codehaus.groovy.runtime.DefaultGroovyMethods.getAt(DefaultGroovyMethods.java:7923) ~[groovy-2.5.7-indy.jar:2.5.7] at org.codehaus.groovy.runtime.dgm$292.invoke(Unknown Source) ~[groovy-2.5.7-indy.jar:2.5.7] at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:244) ~[groovy-2.5.7-indy.jar:2.5.7] at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:53) ~[groovy-2.5.7-indy.jar:2.5.7] at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47) ~[groovy-2.5.7-indy.jar:2.5.7] at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115) ~[groovy-2.5.7-indy.jar:2.5.7] at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:127) ~[groovy-2.5.7-indy.jar:2.5.7] at Script3.run(Script3.groovy:1) ~[?:?] at org.apache.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine.eval(GremlinGroovyScriptEngine.java:674) ~[gremlin-groovy-3.4.3.jar:3.4.3] at org.apache.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine.eval(GremlinGroovyScriptEngine.java:376) ~[gremlin-groovy-3.4.3.jar:3.4.3] at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:233) ~[?:1.8.0_192] at com.baidu.hugegraph.traversal.optimize.HugeScriptTraversal.applyStrategies(HugeScriptTraversal.java:97) ~[hugegraph-core-0.10.4.jar:0.10.4.0] ... 10 more
@forgive2077 建议分为两步,先获取边数量最多的点的分布,然后按照边的数量过滤出来哪些点符合条件:
g.V().groupCount().by(bothE().count()).unfold().order().by(keys,decr).limit(5)
g.V().where(bothE().count().is(100))
大量数据时尽量减少order-by操作,目前gremlin语句还没有做order-by优化。此外,图算法【度中心性】原生提供了此需求的能力,由于暂时未开源所以只能在商业版中可用。
好的,谢谢
请教一下,我用异步Gremlin查询边数最多的TOP5个点这样的需求时Task一直是running的状态 服务器会时不时的崩溃,需要重启 日志报的是:backend.BackendExecption 是内存不足的问题吗