Compare with

Comparison of OpenJPA with H2 embedded vs DataNucleus with MySQL server

Each of the following tables focuses on a specific database operation, where the last table presents average results comparison.

Speed comparison of JPA database persistence operations (normalized score, higher is better)

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
H2 embedded
DataNucleus
MySQL server
OpenJPA
H2 embedded
DataNucleus
MySQL server
OpenJPA
H2 embedded
DataNucleus
MySQL server
Basic Person Test17.12.65.81.411.52.0
Element Collection Test10.91.04.90.487.90.76
Inheritance Test14.32.55.91.310.11.9
Indexing Test24.44.013.72.519.13.3
Graph (Binary Tree) Test6.81.16.70.996.71.1
Multithreading Test34.26.210.22.522.24.4
All Tests17.92.97.91.512.92.2

The results above show that in general OpenJPA with H2 embedded is much more efficient than DataNucleus with MySQL server in persisting JPA entity objects to the database. Comparing the normalized speed of DataNucleus with MySQL database server (2.2) to the normalized speed of OpenJPA with H2 embedded database (12.9) reveals that in these tests, OpenJPA with H2 embedded is 5.9 times faster than DataNucleus with MySQL server.

A huge performance gap has been detected when using JPA element collections with small transaction size. Comparing the normalized speed of DataNucleus with MySQL database server (1.0) to the normalized speed of OpenJPA with H2 embedded database (10.9) reveals that in that case, OpenJPA with H2 embedded is 10.9 times faster than DataNucleus with MySQL server.

Speed comparison of JPA database retrieval operations (normalized score, higher is better)

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
H2 embedded
DataNucleus
MySQL server
OpenJPA
H2 embedded
DataNucleus
MySQL server
OpenJPA
H2 embedded
DataNucleus
MySQL server
Basic Person Test14.60.9627.29.320.95.1
Element Collection Test0.00460.184.30.772.10.47
Inheritance Test0.0110.557.48.53.74.5
Indexing Test17.00.8235.09.726.05.3
Graph (Binary Tree) Test1.02.11.43.51.22.8
Multithreading Test18.70.2727.67.823.14.0
All Tests8.60.8117.16.612.83.7

The results above show that in general OpenJPA with H2 embedded is much more efficient than DataNucleus with MySQL server in retrieving JPA entity objects from the database. Comparing the normalized speed of DataNucleus with MySQL database server (3.7) to the normalized speed of OpenJPA with H2 embedded database (12.8) reveals that in these tests, OpenJPA with H2 embedded is 3.5 times faster than DataNucleus with MySQL server.

A huge performance gap has been detected when using multithreading with small retrieval size. Comparing the normalized speed of DataNucleus with MySQL database server (0.27) to the normalized speed of OpenJPA with H2 embedded database (18.7) reveals that in that case, OpenJPA with H2 embedded is 69.3 times faster than DataNucleus with MySQL server.

On the other hand, OpenJPA with H2 embedded is slower, for instance, when using class inheritance in the object model with small retrieval size. Comparing the normalized speed of OpenJPA with H2 embedded database (0.011) to the normalized speed of DataNucleus with MySQL database server (0.55) reveals that in that case, OpenJPA with H2 embedded is 50.0 times slower than DataNucleus with MySQL server.

Speed comparison of JPA database query operations (normalized score, higher is better)

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
H2 embedded
DataNucleus
MySQL server
OpenJPA
H2 embedded
DataNucleus
MySQL server
OpenJPA
H2 embedded
DataNucleus
MySQL server
Basic Person Test5.07.21.12.23.14.7
Element Collection Test1.75.81.30.271.53.1
Inheritance Test2.22.91.21.71.72.3
Indexing Test13.80.008423.22.518.51.2
Multithreading Test1.4failed0.60failed0.99failed
All Tests4.84.05.51.75.12.8

DataNucleus with MySQL server has failed in 2 tests (see exceptions).

The results above show that in general OpenJPA with H2 embedded is more efficient than DataNucleus with MySQL server in executing the tested JPA queries.

A huge performance gap has been detected when using database indexes with small retrieval size. Comparing the normalized speed of DataNucleus with MySQL database server (0.0084) to the normalized speed of OpenJPA with H2 embedded database (13.8) reveals that in that case, OpenJPA with H2 embedded is 1,643 times faster than DataNucleus with MySQL server.

On the other hand, OpenJPA with H2 embedded is slower, for instance, when using JPA element collections with small retrieval size. Comparing the normalized speed of OpenJPA with H2 embedded database (1.7) to the normalized speed of DataNucleus with MySQL database server (5.8) reveals that in that case, OpenJPA with H2 embedded is 3.4 times slower than DataNucleus with MySQL server.

Speed comparison of JPA database update operations (normalized score, higher is better)

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
H2 embedded
DataNucleus
MySQL server
OpenJPA
H2 embedded
DataNucleus
MySQL server
OpenJPA
H2 embedded
DataNucleus
MySQL server
Basic Person Test10.00.616.01.18.00.88
Element Collection Test0.0110.313.80.441.90.38
Inheritance Test0.0460.515.01.82.51.1
Indexing Test8.90.687.02.28.01.5
Graph (Binary Tree) Test2.40.911.30.471.90.69
Multithreading Test16.60.644.3failed10.40.64
All Tests6.30.614.61.25.40.88

DataNucleus with MySQL server has failed in 1 tests (see exceptions).

The results above show that in general OpenJPA with H2 embedded is much more efficient than DataNucleus with MySQL server in updating JPA entity objects in the database. Comparing the normalized speed of DataNucleus with MySQL database server (0.88) to the normalized speed of OpenJPA with H2 embedded database (5.4) reveals that in these tests, OpenJPA with H2 embedded is 6.1 times faster than DataNucleus with MySQL server.

A huge performance gap has been detected when using multithreading with small transaction size. Comparing the normalized speed of DataNucleus with MySQL database server (0.64) to the normalized speed of OpenJPA with H2 embedded database (16.6) reveals that in that case, OpenJPA with H2 embedded is 25.9 times faster than DataNucleus with MySQL server.

On the other hand, OpenJPA with H2 embedded is slower, for instance, when using JPA element collections with small transaction size. Comparing the normalized speed of OpenJPA with H2 embedded database (0.011) to the normalized speed of DataNucleus with MySQL database server (0.31) reveals that in that case, OpenJPA with H2 embedded is 28.2 times slower than DataNucleus with MySQL server.

Speed comparison of JPA database removal operations (normalized score, higher is better)

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
H2 embedded
DataNucleus
MySQL server
OpenJPA
H2 embedded
DataNucleus
MySQL server
OpenJPA
H2 embedded
DataNucleus
MySQL server
Basic Person Test18.30.7011.11.314.71.0
Element Collection Test0.0120.172.90.401.40.29
Inheritance Test0.0300.416.61.33.30.87
Indexing Test23.21.79.71.916.41.8
Graph (Binary Tree) Test1.80.492.40.462.10.47
Multithreading Test31.2failed17.3failed24.2failed
All Tests12.40.698.31.110.40.89

DataNucleus with MySQL server has failed in 2 tests (see exceptions).

The results above show that in general OpenJPA with H2 embedded is much more efficient than DataNucleus with MySQL server in deleting JPA entity objects from the database. Comparing the normalized speed of DataNucleus with MySQL database server (0.89) to the normalized speed of OpenJPA with H2 embedded database (10.4) reveals that in these tests, OpenJPA with H2 embedded is 11.7 times faster than DataNucleus with MySQL server.

A huge performance gap has been detected when using simple basic entities with small transaction size. Comparing the normalized speed of DataNucleus with MySQL database server (0.70) to the normalized speed of OpenJPA with H2 embedded database (18.3) reveals that in that case, OpenJPA with H2 embedded is 26.1 times faster than DataNucleus with MySQL server.

On the other hand, OpenJPA with H2 embedded is slower, for instance, when using JPA element collections with small transaction size. Comparing the normalized speed of OpenJPA with H2 embedded database (0.012) to the normalized speed of DataNucleus with MySQL database server (0.17) reveals that in that case, OpenJPA with H2 embedded is 14.2 times slower than DataNucleus with MySQL server.

Comparison of JPA/Database speed - the averages (normalized score, higher is better)

Transaction/Retrieval SizeFew EntitiesMany EntitiesAverage Score
 OpenJPA
H2 embedded
DataNucleus
MySQL server
OpenJPA
H2 embedded
DataNucleus
MySQL server
OpenJPA
H2 embedded
DataNucleus
MySQL server
Basic Person Test13.02.410.23.111.62.7
Element Collection Test2.51.53.40.473.00.99
Inheritance Test3.31.45.22.94.32.1
Indexing Test17.51.417.73.817.62.6
Graph (Binary Tree) Test3.01.23.01.43.01.3
Multithreading Test20.42.412.05.116.23.5
All Tests10.21.78.82.69.52.1

The results above show that in general OpenJPA with H2 embedded is much more efficient than DataNucleus with MySQL server in performing JPA database operations. Comparing the normalized speed of DataNucleus with MySQL database server (2.1) to the normalized speed of OpenJPA with H2 embedded database (9.5) reveals that in these tests, OpenJPA with H2 embedded is 4.5 times faster than DataNucleus with MySQL server.

A huge performance gap has been detected when using database indexes with small transaction/retrieval size. Comparing the normalized speed of DataNucleus with MySQL database server (1.4) to the normalized speed of OpenJPA with H2 embedded database (17.5) reveals that in that case, OpenJPA with H2 embedded is 12.5 times faster than DataNucleus with MySQL server.

Other Head to Head DBMS/JPA Comparisons