Reputation: 23
I'm using tinkerpop3 gremlin server.
I execute a simple query (using the standard REST api) to get edges of a vertex.
g.traversal().V(123456).outE('label')
When there are many results (about 2000-3000), the query is very slow, more than 20 seconds to get the JSON-results response.
The interesting thing is when I'm using the gremlin shell, running the same query, it takes about 1 second to receive the edges objects results!
I'm not sure, but I suspect that maybe the gremlin-server's JSON parser (I'm using GraphSon) is problematic (maybe very slow).
Any ideas? Thanks
Upvotes: 1
Views: 766
Reputation: 46216
That does seem pretty slow, but it is building a potentially large result set in memory and serializing a graph element such as an entire Vertex or Edge is a bit "heavy" because it tries to match the general structure of the Vertex/Edge API hierarchy. We've seen where you can get a faster serialization time by just changing your query to:
g.V(123456).outE('label').valueMap()
or if you need the id/label as well:
g.V(123456).outE('label').valueMap(true)
in this way the hierarchy for the Vertex/Edge gets flattened to a simple Map which has less serialization overhead. In short, limit the amount of data you actually need on the client side to improve your performance.
Upvotes: 2