Compare with

Comparison of OpenJPA with H2 embedded vs OpenJPA with Derby 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
OpenJPA
Derby server
OpenJPA
H2 embedded
OpenJPA
Derby server
OpenJPA
H2 embedded
OpenJPA
Derby server
Basic Person Test17.13.15.82.711.52.9
Element Collection Test10.92.04.91.77.91.8
Inheritance Test14.33.05.92.310.12.6
Indexing Test24.44.713.74.119.14.4
Graph (Binary Tree) Test6.80.716.70.646.70.67
Multithreading Test34.26.010.23.822.24.9
All Tests17.93.37.92.512.92.9

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

A huge performance gap has been detected when using graphs of objects with large transaction size. Comparing the normalized speed of OpenJPA with Derby database server (0.64) to the normalized speed of OpenJPA with H2 embedded database (6.7) reveals that in that case, OpenJPA with H2 embedded is 10.5 times faster than OpenJPA with Derby server.

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
H2 embedded
OpenJPA
Derby server
OpenJPA
H2 embedded
OpenJPA
Derby server
OpenJPA
H2 embedded
OpenJPA
Derby server
Basic Person Test14.60.7827.211.620.96.2
Element Collection Test0.00460.00244.31.12.10.54
Inheritance Test0.0110.0147.45.03.72.5
Indexing Test17.00.6235.013.026.06.8
Graph (Binary Tree) Test1.00.0651.40.391.20.23
Multithreading Test18.71.627.619.023.110.3
All Tests8.60.5117.18.412.84.4

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

A huge performance gap has been detected when using database indexes with small retrieval size. Comparing the normalized speed of OpenJPA with Derby database server (0.62) to the normalized speed of OpenJPA with H2 embedded database (17.0) reveals that in that case, OpenJPA with H2 embedded is 27.4 times faster than OpenJPA with Derby server.

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
H2 embedded
OpenJPA
Derby server
OpenJPA
H2 embedded
OpenJPA
Derby server
OpenJPA
H2 embedded
OpenJPA
Derby server
Basic Person Test5.029.21.15.53.117.3
Element Collection Test1.72.21.31.41.51.8
Inheritance Test2.22.21.21.01.71.6
Indexing Test13.82.223.211.718.57.0
Multithreading Test1.435.50.608.30.9921.9
All Tests4.814.35.55.65.19.9

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

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

On the other hand, OpenJPA with Derby server is slower, for instance, when using database indexes with small retrieval size. Comparing the normalized speed of OpenJPA with Derby database server (2.2) to the normalized speed of OpenJPA with H2 embedded database (13.8) reveals that in that case, OpenJPA with Derby server is 6.3 times slower than OpenJPA with H2 embedded.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
H2 embedded
OpenJPA
Derby server
OpenJPA
H2 embedded
OpenJPA
Derby server
OpenJPA
H2 embedded
OpenJPA
Derby server
Basic Person Test10.01.56.04.08.02.8
Element Collection Test0.0110.00813.81.91.90.94
Inheritance Test0.0460.0435.03.82.51.9
Indexing Test8.91.87.06.88.04.3
Graph (Binary Tree) Test2.40.161.30.271.90.22
Multithreading Test16.66.94.35.010.45.9
All Tests6.31.74.63.65.42.7

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

A huge performance gap has been detected when using graphs of objects with small transaction size. Comparing the normalized speed of OpenJPA with Derby database server (0.16) to the normalized speed of OpenJPA with H2 embedded database (2.4) reveals that in that case, OpenJPA with H2 embedded is 15.0 times faster than OpenJPA with Derby server.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
H2 embedded
OpenJPA
Derby server
OpenJPA
H2 embedded
OpenJPA
Derby server
OpenJPA
H2 embedded
OpenJPA
Derby server
Basic Person Test18.31.411.13.714.72.5
Element Collection Test0.0120.00822.91.41.40.71
Inheritance Test0.0300.0356.62.53.31.3
Indexing Test23.22.39.73.516.42.9
Graph (Binary Tree) Test1.80.132.40.352.10.24
Multithreading Test31.23.617.34.024.23.8
All Tests12.41.38.32.610.41.9

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

A huge performance gap has been detected when using graphs of objects with small transaction size. Comparing the normalized speed of OpenJPA with Derby database server (0.13) to the normalized speed of OpenJPA with H2 embedded database (1.8) reveals that in that case, OpenJPA with H2 embedded is 13.8 times faster than OpenJPA with Derby server.

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

Transaction/Retrieval SizeFew EntitiesMany EntitiesAverage Score
 OpenJPA
H2 embedded
OpenJPA
Derby server
OpenJPA
H2 embedded
OpenJPA
Derby server
OpenJPA
H2 embedded
OpenJPA
Derby server
Basic Person Test13.07.210.25.511.66.4
Element Collection Test2.50.843.41.53.01.2
Inheritance Test3.31.15.22.94.32.0
Indexing Test17.52.317.77.817.65.1
Graph (Binary Tree) Test3.00.273.00.413.00.34
Multithreading Test20.410.712.08.016.29.4
All Tests10.23.98.84.59.54.2

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

A huge performance gap has been detected when using graphs of objects with small transaction/retrieval size. Comparing the normalized speed of OpenJPA with Derby database server (0.27) to the normalized speed of OpenJPA with H2 embedded database (3.0) reveals that in that case, OpenJPA with H2 embedded is 11.1 times faster than OpenJPA with Derby server.

Other Head to Head DBMS/JPA Comparisons