JanusGraph AdjacentVertex Optimization
Hiya,
I'm wondering if anyone has any advice on how to inspect the provider-side optimizations being applied to my gremlin code by janus graph.
Currently when I call
explain
I get the following output.
Which isn't very helpful of course.
Secondly, I'm trying to use explain to figure out whether it's possible to have JanusGraph apply its AdjacentVertex optimisation (can find related code around here) when the vertex is stored dynamically using as
rather then being a id known ahead of time.
i.e. do we get adjacency behaviour from the query
or is it possible to get the behaviour for something similar without using two queries.
Thanks in advance.Solution:Jump to solution
TinkerPop applies all optimization strategies to all queries (including JanusGraph internal optimizations). However, JanusGraph skips some of the optimizations as it sees necessary. We don't currently store information if the optimization strategy modified any part of the query or was simply skipped (potential feature request). Thus, the way I would test if the optimization strategy actually makes any changes or not is to debug the query with the breaking point placed in the necessary optimization strategy.
I.e. in your case I would place a breaking point here: https://github.com/JanusGraph/janusgraph/blob/c9576890b5e9dc48676ccc16a58552b8a665e5f0/janusgraph-core/src/main/java/org/janusgraph/graphdb/tinkerpop/optimize/strategy/AdjacentVertexOptimizerStrategy.java#L58C13-L58C28
If this part is triggered during your query execution - optimization works in this case....
GitHub
janusgraph/janusgraph-core/src/main/java/org/janusgraph/graphdb/tin...
JanusGraph: an open-source, distributed graph database - JanusGraph/janusgraph
2 Replies
Currently when I call explain I get the following output.The
explain()
step doesn't work in remote contexts. There is an open issue to make that possible: https://issues.apache.org/jira/browse/TINKERPOP-2128 If you want an explain()
you would either have to send a Gremlin script to the server with submit()
which should return the string representation of the explain that executed on the server. or you would have to just start up a Gremlin Console and connect to JanusGraph in embedded mode.
Secondly, I'm trying to use explain to figure out whether it's possible to have JanusGraph apply its AdjacentVertex optimisation...i'm not sure i understand this question. maybe someone from @janusgraph can help?
Solution
TinkerPop applies all optimization strategies to all queries (including JanusGraph internal optimizations). However, JanusGraph skips some of the optimizations as it sees necessary. We don't currently store information if the optimization strategy modified any part of the query or was simply skipped (potential feature request). Thus, the way I would test if the optimization strategy actually makes any changes or not is to debug the query with the breaking point placed in the necessary optimization strategy.
I.e. in your case I would place a breaking point here: https://github.com/JanusGraph/janusgraph/blob/c9576890b5e9dc48676ccc16a58552b8a665e5f0/janusgraph-core/src/main/java/org/janusgraph/graphdb/tinkerpop/optimize/strategy/AdjacentVertexOptimizerStrategy.java#L58C13-L58C28
If this part is triggered during your query execution - optimization works in this case.
GitHub
janusgraph/janusgraph-core/src/main/java/org/janusgraph/graphdb/tin...
JanusGraph: an open-source, distributed graph database - JanusGraph/janusgraph