Skip to content
This repository

Performance Tests of Neo4j and Neo4j.rb

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 jars
Octocat-spinner-32 src
Octocat-spinner-32 Gemfile
Octocat-spinner-32 README
Octocat-spinner-32 Rakefile
Octocat-spinner-32 batch_import.rb
Octocat-spinner-32 jruby.rb
Octocat-spinner-32 model.rb
Octocat-spinner-32 tx_util.rb
Octocat-spinner-32 wrapper.rb
Octocat-spinner-32 wrapper_import.rb
README
== Performance tests of Neo4j.rb

The objective of these performance tests is to compare running Neo4j from Java with running it from JRuby.
I'm sure it's possible to tweak these tests to get even better performance.

The test creates a Neo4j database by importing file information from the filesystem. Then it calculates the total size of all those files by traversing the tree in Neo4j.

There are three tests:
* Running the traversal just using the Java API
* Running the traversal just using the Java API from JRuby
* Running the traversal using the Neo4j.rb wrapper


=== TODO

Check the JRuby flag if it will increase the performance

  -Xji.objectProxyCache=false 

=== To Execute

Type:

  > gem install bundler
  > bundle 
  > rake create
  > rake java  
  > rake jruby
  > rake wrapper

rake create asks for an location on the filesystem. You should
have at least 500.000 folder and files in that location in order to
get some realistic test result.

=== My Results

Calling directly the Java API from JRuby is around 6-7 times slower then just executing everything from Java.
Running my JRuby wrapper is around 20 % slower then directly calling the Java API from JRuby.
Maybe it's because I'm extending some java classes from JRuby or using a code block in a traverser.each |node| ...

It also looks like the bigger graph to traverse the slower JRuby is compared to directly using Java.
On just traversing 40.000 nodes JRuby is only 3-4 times slower. 

I'm using JRuby 1.5.5 on Ubuntu 32 bit OS, Java version 1.6.0_22

=== Running from Java

> rake java

java -Xms2048m -Xmx2048m -Xmn512m -server -cp jars/neo4j-kernel-1.2-1.2.M03.jar:jars/geronimo-jta_1.1_spec-1.1.1.jar:target neo4j.NeoTraversal
1 -- traversed 568291 nodes, 40616985760 bytes, in 9.553 seconds
2 -- traversed 568291 nodes, 40616985760 bytes, in 0.671 seconds
3 -- traversed 568291 nodes, 40616985760 bytes, in 0.636 seconds
4 -- traversed 568291 nodes, 40616985760 bytes, in 1.087 seconds
5 -- traversed 568291 nodes, 40616985760 bytes, in 0.615 seconds
6 -- traversed 568291 nodes, 40616985760 bytes, in 0.62 seconds
7 -- traversed 568291 nodes, 40616985760 bytes, in 0.615 seconds
8 -- traversed 568291 nodes, 40616985760 bytes, in 0.944 seconds
9 -- traversed 568291 nodes, 40616985760 bytes, in 0.623 seconds
10 -- traversed 568291 nodes, 40616985760 bytes, in 0.624 seconds
11 -- traversed 568291 nodes, 40616985760 bytes, in 0.955 seconds
12 -- traversed 568291 nodes, 40616985760 bytes, in 0.709 seconds
13 -- traversed 568291 nodes, 40616985760 bytes, in 1.11 seconds
14 -- traversed 568291 nodes, 40616985760 bytes, in 0.709 seconds
15 -- traversed 568291 nodes, 40616985760 bytes, in 0.616 seconds
16 -- traversed 568291 nodes, 40616985760 bytes, in 0.689 seconds
17 -- traversed 568291 nodes, 40616985760 bytes, in 0.628 seconds
18 -- traversed 568291 nodes, 40616985760 bytes, in 0.627 seconds
19 -- traversed 568291 nodes, 40616985760 bytes, in 0.617 seconds
20 -- traversed 568291 nodes, 40616985760 bytes, in 0.619 seconds
21 -- traversed 568291 nodes, 40616985760 bytes, in 0.612 seconds
22 -- traversed 568291 nodes, 40616985760 bytes, in 0.614 seconds
23 -- traversed 568291 nodes, 40616985760 bytes, in 0.618 seconds
24 -- traversed 568291 nodes, 40616985760 bytes, in 0.62 seconds
25 -- traversed 568291 nodes, 40616985760 bytes, in 0.617 seconds

=== Running directly from JRuby

> rake jruby

/usr/bin/env jruby -J-Xms2048m -J-Xmx2048m -J-Xmn512m --server jruby.rb
JRuby limited openssl loaded. http://jruby.org/openssl
gem install jruby-openssl for full support.
1 -- traversed 568291 nodes 40616985760 bytes, in 14.459 seconds
2 -- traversed 568291 nodes 40616985760 bytes, in 5.176 seconds
3 -- traversed 568291 nodes 40616985760 bytes, in 4.418 seconds
4 -- traversed 568291 nodes 40616985760 bytes, in 4.449 seconds
5 -- traversed 568291 nodes 40616985760 bytes, in 4.088 seconds
6 -- traversed 568291 nodes 40616985760 bytes, in 4.354 seconds
7 -- traversed 568291 nodes 40616985760 bytes, in 4.712 seconds
8 -- traversed 568291 nodes 40616985760 bytes, in 4.191 seconds
9 -- traversed 568291 nodes 40616985760 bytes, in 4.187 seconds
10 -- traversed 568291 nodes 40616985760 bytes, in 4.253 seconds
11 -- traversed 568291 nodes 40616985760 bytes, in 4.29 seconds
12 -- traversed 568291 nodes 40616985760 bytes, in 4.354 seconds
13 -- traversed 568291 nodes 40616985760 bytes, in 4.36 seconds
14 -- traversed 568291 nodes 40616985760 bytes, in 4.378 seconds
15 -- traversed 568291 nodes 40616985760 bytes, in 4.4 seconds
16 -- traversed 568291 nodes 40616985760 bytes, in 4.403 seconds
17 -- traversed 568291 nodes 40616985760 bytes, in 3.48 seconds
18 -- traversed 568291 nodes 40616985760 bytes, in 4.406 seconds
19 -- traversed 568291 nodes 40616985760 bytes, in 4.399 seconds
20 -- traversed 568291 nodes 40616985760 bytes, in 4.428 seconds
21 -- traversed 568291 nodes 40616985760 bytes, in 4.455 seconds
22 -- traversed 568291 nodes 40616985760 bytes, in 4.445 seconds
23 -- traversed 568291 nodes 40616985760 bytes, in 4.351 seconds
24 -- traversed 568291 nodes 40616985760 bytes, in 3.653 seconds
25 -- traversed 568291 nodes 40616985760 bytes, in 4.475 seconds

=== Running from Neo4j.rb wrapper

> rake wrapper

/usr/bin/env jruby -J-Xms2048m -J-Xmx2048m -J-Xmn512m --server wrapper.rb
JRuby limited openssl loaded. http://jruby.org/openssl
gem install jruby-openssl for full support.
1 -- traversed 568290 nodes 40616985760 bytes, in 15.467 seconds
2 -- traversed 568290 nodes 40616985760 bytes, in 5.66 seconds
3 -- traversed 568290 nodes 40616985760 bytes, in 5.272 seconds
4 -- traversed 568290 nodes 40616985760 bytes, in 5.092 seconds
5 -- traversed 568290 nodes 40616985760 bytes, in 5.12 seconds
6 -- traversed 568290 nodes 40616985760 bytes, in 4.986 seconds
7 -- traversed 568290 nodes 40616985760 bytes, in 5.065 seconds
8 -- traversed 568290 nodes 40616985760 bytes, in 5.026 seconds
9 -- traversed 568290 nodes 40616985760 bytes, in 5.077 seconds
10 -- traversed 568290 nodes 40616985760 bytes, in 5.076 seconds
11 -- traversed 568290 nodes 40616985760 bytes, in 5.006 seconds
12 -- traversed 568290 nodes 40616985760 bytes, in 4.715 seconds
13 -- traversed 568290 nodes 40616985760 bytes, in 5.101 seconds
14 -- traversed 568290 nodes 40616985760 bytes, in 5.166 seconds
15 -- traversed 568290 nodes 40616985760 bytes, in 5.607 seconds
16 -- traversed 568290 nodes 40616985760 bytes, in 4.88 seconds
17 -- traversed 568290 nodes 40616985760 bytes, in 5.19 seconds
18 -- traversed 568290 nodes 40616985760 bytes, in 5.09 seconds
19 -- traversed 568290 nodes 40616985760 bytes, in 5.097 seconds
20 -- traversed 568290 nodes 40616985760 bytes, in 4.776 seconds
21 -- traversed 568290 nodes 40616985760 bytes, in 5.125 seconds
22 -- traversed 568290 nodes 40616985760 bytes, in 5.105 seconds
23 -- traversed 568290 nodes 40616985760 bytes, in 5.086 seconds
24 -- traversed 568290 nodes 40616985760 bytes, in 4.742 seconds
25 -- traversed 568290 nodes 40616985760 bytes, in 5.119 seconds
Something went wrong with that request. Please try again.