Improve traversal query performance

63 views
Skip to first unread message

Yingjie Li

unread,
Aug 15, 2022, 6:29:10 AM8/15/22
to Gremlin-users
Hello All, 

I would like to start from a particular  source node ( id = 01F546'), traverse both direction for x number (4 in the below example)  of hops , and list the properties of  the first 200  destination nodes meeting certain creteria ( 'type' = output' in the belwo sample). I have set up the timeLimt to make sure the query return before time out. 

I have created composite/mixed  indexes on 'id', 'type'  each. 

For a graph of 250k nodes and 400k edges, the above query takes about ~7 second via gremline query console.  What can be done to speed up the performance?

Thank you,
Yingjie

Query: g.V().has('id',eq('01F546')).emit().repeat(bothE().otherV().timeLimit(300000)).times(4).has('type',eq('output')).map(properties().group().by(key()).by(value())).dedup().limit(200).toList()




The output of the profile is:

HasStep([type.eq(output)])                                            17          17         627.249    90.79
TraversalMapStep([JanusGraphMultiQueryStep, Jan...                    17          17           3.129     0.45
  JanusGraphMultiQueryStep                                            17          17           0.207
  JanusGraphPropertiesStep(property)                                 180         180           1.520
    \_condition=(PROPERTY AND visibility:normal)
    \_orders=[]
    \_isFitted=true
    \_isOrdered=true
    \_query=SliceQuery[0x40,0x60)
    \_multi=true
    \_vertices=1
    optimization                                                                               0.001
    optimization                                                                               0.001
    optimization                                                                               0.001
    optimization                                                                               0.001
    optimization                                                                               0.001
    optimization                                                                               0.001
    optimization                                                                               0.001
    optimization                                                                               0.001
    optimization                                                                               0.001
    optimization                                                                               0.001
    optimization                                                                               0.001
    optimization                                                                               0.001
    optimization                                                                               0.001
    optimization                                                                               0.001
    optimization                                                                               0.001
    optimization                                                                               0.001
    optimization                                                                               0.001
  GroupStep(key,[PropertyValueStep])                                  17          17           1.204
    PropertyValueStep                                                180         180           0.279
DedupGlobalStep(null,null)                                            11          11           0.202     0.03
RangeGlobalStep(0,20)                                                 11          11           0.151     0.02
                                            >TOTAL                     -           -         690.901        -
    optimization                                                                               0.001
    optimization                                                                               0.001
    optimization                                                                               0.001
    optimization                                                                               0.001
    optimization                                                                               0.001
    optimization                                                                               0.001
    optimization                                                                               0.001
    optimization                                                                               0.000
    optimization                                                                               0.001
    optimization                                                                               0.001
    optimization                                                                               0.001
    optimization                                                                               0.001
    optimization                                                                               0.001
    optimization                                                                               0.001
    optimization                                                                               0.001
    optimization                                                                               0.001
    optimization                                                                               0.001
    optimization                                                                               0.000
    optimization                                                                               0.001
    optimization                                                                               0.000
    optimization                                                                               0.001
    optimization                                                                               0.001
    optimization                                                                               0.001
    optimization                                                                               0.001
    optimization                                                                               0.001
    optimization                                                                               0.001
    optimization                                                                               0.001
    optimization                                                                               0.000
    optimization                                                                               0.000
    optimization                                                                               0.000
    optimization                                                                               0.001
    optimization                                                                               0.000
    optimization                                                                               0.000
  GroupStep(key,[PropertyValueStep])                                 109         109           6.813
    PropertyValueStep                                               1083        1083           1.854
DedupGlobalStep(null,null)                                            76          76           0.610     0.01
                                            >TOTAL                     -           -        6721.808        -


HadoopMarc

unread,
Aug 18, 2022, 1:50:19 AM8/18/22
to Gremlin-users
Questions specific to JanusGraph are best posted on:

If you post on one of these please also add:
  • what storage backend was used
  • the profile output seems like a combination of two queries. What does the first one with a duration of 0.690 sec belong to
  • link to the SO question you posted
Best wishes,    Marc
Op maandag 15 augustus 2022 om 12:29:10 UTC+2 schreef yingj...@gmail.com:

Yingjie Li

unread,
Aug 19, 2022, 8:24:19 AM8/19/22
to gremli...@googlegroups.com
Hello Marc,

Thanks for your reply, I posted here as I am looking for a better optimized gremlin query.  I will post this to the Janusgraph  group channel as you suggested.  The profile is from one single query. 

I am also looking for an enhanced query which gives me all the paths. e., edges and as well as the nodes  (with nodes properties) of the traversal until it stops  at nodes with certain criteria. 

The below query 
g.V().has('id',eq('01F546')).emit().repeat(bothE().otherV()).times(4).has('type',eq('output')).dedup().path().by(valueMap())

does produce the path with edges and nodes with properties, but as I am submitting  gremlin command via  gremlin-python, the returned result is text and needs to be customer parsed.   Is there an alternative way to make the result more consumable ?

Yingjie


--
You received this message because you are subscribed to a topic in the Google Groups "Gremlin-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gremlin-users/DCpNNTYMxVY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gremlin-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/83d27db4-d299-4dd4-b9a8-56cae588f874n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages