I am using DataStax Enterprise Graph and would like to stream all nodes from the graph database to my app using Gremlin.
Note: I'm communicating with Gremlin server via a WebSocket using sessions for persistent variables.
To do so without pulling all nodes in memory, I first create an iterator on the server:
// called once
iter = g.V();
I then progressively read the iterator into a buffer and return the content of the buffer:
// called multiple times, until it returns an empty array
results = []
while (itemStream.hasNext() && results.size < 5000) {
results.push(itemStream.next())
}
return results
I used to do this with TitanDB and it worked okay (couple thousand nodes read per second).
With DSE Graph it is much slower (330 reads per second) and I get the following error error after having read just 400'000 nodes:
Operation timed out - received only 0 responses.
Is there a better way to do this in DSE Graph?