Last active
August 30, 2016 12:33
-
-
Save robertdale/58d7b7efa0d4d950109a80281e11a65f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// set this to your server gremlin pool | |
cores = 8 | |
cluster = Cluster.open('conf/remote.yaml'); | |
client = cluster.connect(); | |
client.submit("graph.createIndex('name',Vertex.class)").all().get() | |
// NEO4J | |
//client.submit("graph.cypher('CREATE INDEX ON :production_part(name)')").all().get() | |
params = new HashMap(); | |
start = System.currentTimeMillis() | |
total = System.currentTimeMillis() | |
for (p = 0; p <800000; p++) { | |
params.put('pn', 'part'+p) | |
rs = client.submit("g.addV('production_part').property('name',pn).iterate()", params).all() | |
// sync | |
if ( p % cores == 0) rs.get() | |
if (p % 10000 == 0) { | |
elapsed = (System.currentTimeMillis() - start) / 1000.0 | |
println '' + p + ' part time: ' + elapsed + 's' | |
start = System.currentTimeMillis() | |
} | |
} | |
start = System.currentTimeMillis() | |
for (a = 0; a <5; a++) { | |
params.put('A', 'assembly'+a) | |
client.submit("g.addV('production_part').property('name',A).iterate()", params).all().get() | |
} | |
elapsed = (System.currentTimeMillis() - start) / 1000.0 | |
println 'assembly time: ' + elapsed + 's' | |
start = System.currentTimeMillis() | |
for (a = 0; a<5; a++) { | |
params.put('an', 'assembly'+a) | |
for (p = 0; p <800000; p++) { | |
params.put('pn', 'part'+p) | |
rs = client.submit("g.V().has('production_part','name',an).as('a').V().has('production_part','name',pn).addE('has_part').from('a').iterate()", params).all() | |
// sync | |
if ( p % cores == 0) rs.get() | |
if (p % 10000 == 0) { | |
elapsed = (System.currentTimeMillis() - start) / 1000.0 | |
println '' + a + ':' + p + ' edges time: ' + elapsed + 's' | |
start = System.currentTimeMillis() | |
} | |
} | |
} | |
println "Total time: " + ((System.currentTimeMillis() - total) / 1000.0) | |
cluster.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment