Titan: How to check what indexes if any, a gremlin query uses.

339 views
Skip to first unread message

cathal coffey

unread,
Oct 19, 2014, 3:38:06 PM10/19/14
to aureliu...@googlegroups.com
I have the following gremlin query

g.V('name', fqdn).inE('bind').has('timestamp', T.lte, timestamp)
    .groupBy{it.outV().next().getProperty('name')}{it}{it.max{it.getProperty('timestamp')}}.cap().next().values().
    _().as('e').outV().filter({ 
        b, m -> !b.outE('bind').has('timestamp', T.gt, m.get('e').getProperty('timestamp')).has('timestamp', T.lte, timestamp).hasNext()
    }).toList()

I am currently trying to compute the mean time of 10,000 executions of this query with different parameters. There are 2 inputs to this function fqdn and timestamp which take values for example fqdn = 'examplefqdn.com' and timestamp = 1412546397. I have used a similar testing harness to compute timings for other gremlin queries and have been happy to achieve results like mean=200ms, std=10ms.

However the above query is more complicated than any of my previous and unfortunately Rexster is timing out on many executions after 8 seconds. The executions that do exceed usually take over a second.

So my question is: How do I check which indexes if any, are being used when this gremlin query is executed? I am hoping this query is not inherently slow and that something (correct use of indexes) can speed it up.

My graph contains approximately 10,000 vertices (80% have the label IP, 20% have the label FQDN) and 10 million edges all of which have the label BIND.

Below is how I defined the schema for my graph.

TitanManagement mgmt = graph.getManagementSystem();

// Create vertex and edge labels.
mgmt.makeVertexLabel("ip").make();
mgmt.makeVertexLabel("fqdn").make();
EdgeLabel bind = mgmt.makeEdgeLabel("bind").make();

/*
 * Enforce that Vertex names are unique across the entire graph.
 * To enforce uniqueness against an eventually consistent storage backend,
 * the consistency of the index must be explicitly set to enabling locking.
 */
final PropertyKey name = mgmt.makePropertyKey("name").dataType(String.class).make();
TitanGraphIndex namei = mgmt.buildIndex("name", Vertex.class).addKey(name).unique().buildCompositeIndex();
mgmt.setConsistency(namei, ConsistencyModifier.LOCK);

final PropertyKey timestamp = mgmt.makePropertyKey("timestamp").dataType(Integer.class).make();
mgmt.buildEdgeIndex(bind, "bindByTime", Direction.BOTH, Order.DESC, timestamp);

mgmt.commit();

Stephen Mallette

unread,
Oct 20, 2014, 7:06:13 AM10/20/14
to aureliu...@googlegroups.com
How are you making the requests to Rexster (REST or RexPro)?  Are those 10K executions happening concurrently?  

--
You received this message because you are subscribed to the Google Groups "Aurelius" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aureliusgraph...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/aureliusgraphs/92b3ab58-6398-4b59-9027-8767d512e8d2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Srinivas Rao

unread,
May 28, 2015, 9:07:49 AM5/28/15
to aureliu...@googlegroups.com, coffey...@gmail.com
Did you found any way to check it. I am also looking for the way to check it. I am using REST.

Matthias Broecheler

unread,
Jun 11, 2015, 10:16:48 PM6/11/15
to aureliu...@googlegroups.com, coffey...@gmail.com
This has been solved with the new profiling capabilities of TP3 in Titan09M2 but isn't production ready until Titan 1.0 GA

--
You received this message because you are subscribed to the Google Groups "Aurelius" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aureliusgraph...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages