5

Most databases provide a mechanism for users to list running queries and cancel them if required. This is particularly useful is terminating queries that take a lot of time. For example, in MySQL you woul do something like this:

mysql>show processlist;
mysql> kill <pid>;

How can I do Something similar on a gremlin server? So far, the only knob available is the scriptEvaluationTimeout in the yaml configuration, which lets you terminate your request on timeout. I'm interested in an API that can list all running queries and an API that can let me delete queries by ID. If that's not supported already, does tinkerpop have plans to support it in newer versions? SOmething like:

g.query()
g.query('123')
g.query('123').cancel()
2
  • 4
    This is a perfectly fine question for those who know the TinkerPop ecosystem to which this question is addressed. Commented Oct 30, 2018 at 0:25
  • 1
    I am inclined to agree with Stephen, the question is can I cancel a running query for which Stephen then provides a perfectly reasonable answer so why down vote the question and put on hold? Commented Oct 30, 2018 at 10:47

1 Answer 1

6

There is nothing in Gremlin Server that will list running queries. The server log configured with with a greater verbosity level might give you some hints, but that's not really a great workaround I guess. Some graph systems will have the native ability to provide you that information - i.e. "a slow query log" sort of functionality but it is not something that TinkerPop exposes to you.

As for cancellation, according to standard TinkerPop semantics a Traversal should respect a request for interruption on a thread. These semantics are enforced by the TinkerPop process test suite. That said, it is still up to the graph provider to properly allow for that behavior. Gremlin Server will attempt to interrupt bytecode or script based traversals that exceed the scriptEvaluationTimeout configuration on the server or the override for that value provided per-request. Setting those timeouts appropriately and using a provider that respects the TinkerPop semantics for cancellation is the best defense you have for a run-away traversal. Note that graph providers that simply implement the Gremlin Server protocols (but may not use Gremlin Server itself) could have different timeout control options.

We definitely improved traversal cancellation from TinkerPop 2.x in our current version at 3.x - hopefully for 4.x we can really nail it perfectly.

3
  • Thanks Stephen. Can we get something like g.query('123').cancel() and similar APIs in an upcoming version? Its best if we can standardize this before vendors build something custom.
    – The-Big-K
    Commented Oct 30, 2018 at 15:56
  • I'm not against a proposal for a cancellation option. Such proposals and following discussions belong on the dev mailing list: lists.apache.org/[email protected] Commented Nov 1, 2018 at 10:02
  • Will do! Thanks.
    – The-Big-K
    Commented Nov 3, 2018 at 21:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.