python - neo4j performance compared to mysql (how can it be improved?) -
this follow can't reproduce/verify performance claims in graph databases , neo4j in action books. have updated setup , tests, , don't want change original question much.
the whole story (including scripts etc) on https://baach.de/members/jhb/neo4j-performance-compared-to-mysql
short version: while trying verify performance claims made in 'graph database' book came following results (querying random dataset containing n people, 50 friends each):
my results 100k people depth neo4j mysql python 1 0.010 0.000 0.000 2 0.018 0.001 0.000 3 0.538 0.072 0.009 4 22.544 3.600 0.330 5 1269.942 180.143 0.758
"*": single run only
my results 1 million people depth neo4j mysql python 1 0.010 0.000 0.000 2 0.018 0.002 0.000 3 0.689 0.082 0.012 4 30.057 5.598 1.079 5 1441.397* 300.000 9.791
"*": single run only
using 1.9.2 on 64bit ubuntu have setup neo4j.properties these values:
neostore.nodestore.db.mapped_memory=250m neostore.relationshipstore.db.mapped_memory=2048m
and neo4j-wrapper.conf with:
wrapper.java.initmemory=1024 wrapper.java.maxmemory=8192
my query neo4j looks (using rest api):
start person=node:node_auto_index(noscenda_name="person123") match (person)-[:friend]->()-[:friend]->(friend) return count(distinct friend);
node_auto_index in place, obviously
is there can speed neo4j (to faster mysql)?
and there another benchmark in stackoverflow same problem.
i'm sorry can't reproduce results. however, on macbook air (1.8 ghz i7, 4 gb ram) 2 gb heap, gcr cache, no warming of caches, , no other tuning, sized dataset (1 million users, 50 friends per person), repeatedly approx 900 ms using traversal framework on 1.9.2:
public class friendofafrienddepth4 { private static final traversaldescription traversaldescription = traversal.description() .depthfirst() .uniqueness( uniqueness.node_global ) .relationships( withname( "friend" ), direction.outgoing ) .evaluator( new evaluator() { @override public evaluation evaluate( path path ) { if ( path.length() >= 4 ) { return evaluation.include_and_prune; } return evaluation.exclude_and_continue; } } ); private final index<node> userindex; public friendofafrienddepth4( graphdatabaseservice db ) { this.userindex = db.index().fornodes( "user" ); } public iterator<path> getfriends( string name ) { return traversaldescription.traverse( userindex.get( "name", name ).getsingle() ) .iterator(); } public int countfriends( string name ) { return count( traversaldescription.traverse( userindex.get( "name", name ).getsingle() ) .nodes().iterator() ); } }
cypher slower, near slow suggest: approx 3 seconds:
start person=node:user(name={name}) match (person)-[:friend]->()-[:friend]->()-[:friend]->()-[:friend]->(friend) return count(friend)
kind regards
ian
Comments
Post a Comment