tinkerpop3
tinkerpop3 copied to clipboard
`g.V().has()` extremely slow
I'm running this code on a 480K nodes graph
g.V().has(property, value)
and it takes more than 8 hours to complete. Am I doing something wrong?
I didn't set up any index.
your experience of some 17 nodes/sec is similar to what I experienced with the following testcase - i get 22 nodes/sec.
For the write performance I was starting out with 5 nodes / second and could improve it by a factor of 1000 by setting blazeGraph.setBulkLoad(true); Unfortunately for the read performance this has no effect.
The same test case using OrientDb runs at 10.000 nodes / sec !
@Test
public void testAnalyze() {
BlazeGraphEmbedded blazeGraph = this.getBlazeGraph();
GraphTraversalSource g = blazeGraph.traversal();
long nodes = g.V().count().next().longValue();
System.out.println(String.format("found %6d nodes", nodes));
Progress progress = new Progress();
g.V().has("ext", "txt").limit(100).forEachRemaining(v -> {
progress.show();
String ocrText=v.property("ocrtext").value().toString();
});
progress.done();
}
class Progress {
private StopWatch stopWatch;
private StopWatch time;
private long count;
private long secs;
public Progress() {
stopWatch = new StopWatch();
time = new StopWatch();
count = 0;
secs = 0;
}
public void show() {
if (!stopWatch.isStarted()) {
stopWatch.start();
time.start();
}
count++;
if (stopWatch.getTime() > 1000) {
secs++;
System.out.print(
String.format("%3d s %6d ...", time.getTime() / 1000, count));
if (secs % 10 == 0)
System.out.println();
stopWatch.reset();
stopWatch.start();
}
}
public void done() {
System.out.println();
System.out.println(String.format("%4.1f s %6d %6d/s",
time.getTime() / 1000.0, count, 1000 * count / time.getTime()));
}
}
This can be of interest: https://graphbenchmark.com
@kuzeko - thx for the hint.