I'm running JanusGraph 0.2.0 with a DynamoDB backend. I'm experiencing some performance issues that just do not make sense to me and I'm hoping someone can explain it to me. Here is my scenario:
I'm running two very simple gremlin queries through both the Gremlin Console and via an HTTP request (issued from the same machine as the Gremlin Server resides on, so no network issues). The queries look like this:
First query:
via console: g.V(127104, 1069144, 590016, 200864).out().count()
via http: curl -XPOST -Hcontent-type:application/json -d '{"gremlin":"g.V(127104, 1069144, 590016, 200864).out().count()}' http://localhost:8182
Second query:
via console: g.V(127104, 1069144, 590016, 200864).out().in().dedup().count()
via http: curl -XPOST -Hcontent-type:application/json -d '{"gremlin":"g.V(127104, 1069144, 590016, 200864).out().in().dedup().count()}' http://localhost:8182
It is by no means a huge graph - the first query returns 750 and the
second query returns 9154. My problem is that I see huge performance
differences between the queries run via HTTP compared to the console.
For the first query both the console and the HTTP request returns
immediately and looking at the gremlin server log, I'm please to see
that the query takes only 1-2 milliseconds in both cases. All is good.
Now for the second query, the picture changes. While the console continues to provide the answer immediately, it now takes between 4 and 5 seconds (!!) for the HTTP request to return the answer! The server log reports roughly the same execution time (some 50-60 ms) for both executions of the second query, so what is going on? I'm only doing a count(), so the slow HTTP response cannot be a serialization issues - it only needs to return a number, just as in the first query.
Can anyone explain this huge delay in HTTP response to me?
JavaTranslator is about 1000x faster than a evaluating a String script and about 3x faster than evaluating a compiled script. JavaTranslator takes about 40 micro-seconds to translate the bytecode, while an uncached String script takes 40 milliseconds.So, what did we learn?1. Bytecode is slick in that we don’t have to use Gremlin-Groovy to evaluate it (if there are no lambdas) and thus, can do everything in Java and fast!2. It very important to always use parameterized queries with GremlinServer/etc. as you can see how costly it is to evaluate a String script repeatedly.
--
You received this message because you are subscribed to the Google Groups "JanusGraph users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to janusgraph-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/janusgraph-users/4733564f-8a52-4f3b-91c7-710e7c42cf47%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/janusgraph-users/c98c76da-ae90-4245-9f7f-d516b591d55a%40googlegroups.com.
To post to this group, send email to janusgra...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/janusgraph-users/5a558912-fd31-4e2f-8d71-fab1527cf12c%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/janusgraph-users/f979a49e-2d0c-4b16-97c1-5eca530906e7%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/janusgraph-users/713fe632-7fd7-44c8-a200-6ffb00c8acc3%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/janusgraph-users/8873b4d7-9527-4e7b-9079-0810bde34194%40googlegroups.com.