Compare with

Comparison of OpenJPA with H2 embedded vs OpenJPA with Derby embedded

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 embedded
OpenJPA
H2 embedded
OpenJPA
Derby embedded
OpenJPA
H2 embedded
OpenJPA
Derby embedded
Basic Person Test17.14.85.82.911.53.9
Element Collection Test10.92.84.91.97.92.4
Inheritance Test14.34.15.92.410.13.3
Indexing Test24.46.113.74.119.15.1
Graph (Binary Tree) Test6.81.56.71.46.71.4
Multithreading Test34.28.710.23.322.26.0
All Tests17.94.77.92.712.93.7

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

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

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
H2 embedded
OpenJPA
Derby embedded
OpenJPA
H2 embedded
OpenJPA
Derby embedded
OpenJPA
H2 embedded
OpenJPA
Derby embedded
Basic Person Test14.614.827.222.620.918.7
Element Collection Test0.00460.00314.32.32.11.2
Inheritance Test0.0110.0157.47.03.73.5
Indexing Test17.011.735.026.526.019.1
Graph (Binary Tree) Test1.00.931.41.21.21.1
Multithreading Test18.725.227.628.623.126.9
All Tests8.68.817.114.712.811.7

The results above show that in general OpenJPA with H2 embedded is slightly more efficient than OpenJPA with Derby embedded in retrieving JPA entity objects from the database.

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
H2 embedded
OpenJPA
Derby embedded
OpenJPA
H2 embedded
OpenJPA
Derby embedded
OpenJPA
H2 embedded
OpenJPA
Derby embedded
Basic Person Test5.049.71.19.93.129.8
Element Collection Test1.72.71.39.61.56.1
Inheritance Test2.22.31.21.31.71.8
Indexing Test13.87.023.217.118.512.1
Multithreading Test1.440.90.6011.70.9926.3
All Tests4.820.55.59.95.115.2

The results above show that in general OpenJPA with Derby embedded is more efficient than OpenJPA with H2 embedded in executing the tested JPA queries. Comparing the normalized speed of OpenJPA with H2 embedded database (5.1) to the normalized speed of OpenJPA with Derby embedded database (15.2) reveals that in these tests, OpenJPA with Derby embedded is 3.0 times faster than OpenJPA with H2 embedded.

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 embedded database (40.9) reveals that in that case, OpenJPA with Derby embedded is 29.2 times faster 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 embedded
OpenJPA
H2 embedded
OpenJPA
Derby embedded
OpenJPA
H2 embedded
OpenJPA
Derby embedded
Basic Person Test10.05.66.05.28.05.4
Element Collection Test0.0110.00903.82.21.91.1
Inheritance Test0.0460.0455.04.62.52.3
Indexing Test8.96.17.08.78.07.4
Graph (Binary Tree) Test2.41.61.30.911.91.3
Multithreading Test16.618.34.34.510.411.4
All Tests6.35.34.64.45.44.8

The results above show that in general OpenJPA with H2 embedded is slightly more efficient than OpenJPA with Derby embedded in updating JPA entity objects in the database.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
H2 embedded
OpenJPA
Derby embedded
OpenJPA
H2 embedded
OpenJPA
Derby embedded
OpenJPA
H2 embedded
OpenJPA
Derby embedded
Basic Person Test18.34.211.14.514.74.3
Element Collection Test0.0120.00712.91.61.40.80
Inheritance Test0.0300.0356.63.03.31.5
Indexing Test23.25.39.73.616.44.4
Graph (Binary Tree) Test1.80.802.40.932.10.86
Multithreading Test31.25.717.36.224.26.0
All Tests12.42.78.33.310.43.0

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

A large performance gap has been detected when using multithreading with small transaction size. Comparing the normalized speed of OpenJPA with Derby embedded database (5.7) to the normalized speed of OpenJPA with H2 embedded database (31.2) reveals that in that case, OpenJPA with H2 embedded is 5.5 times faster than OpenJPA with Derby embedded.

Comparison of database storage efficiency (normalized score, higher is better)

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
H2 embedded
OpenJPA
Derby embedded
OpenJPA
H2 embedded
OpenJPA
Derby embedded
OpenJPA
H2 embedded
OpenJPA
Derby embedded
Basic Person Test27.052.827.052.827.052.8
Element Collection Test30.642.430.642.430.642.4
Inheritance Test27.044.227.044.227.044.2
Indexing Test31.653.132.154.031.953.5
Graph (Binary Tree) Test28.512.821.49.624.911.2
Multithreading Test33.950.79.29.721.530.2
All Tests29.842.724.535.527.239.1

The results above show that in general OpenJPA with Derby embedded is more efficient than OpenJPA with H2 embedded in using disk space.

On the other hand, OpenJPA with Derby embedded is slower, for instance, when using graphs of objects with large transaction size. Comparing the normalized score of OpenJPA with Derby embedded database (9.6) to the normalized score of OpenJPA with H2 embedded database (21.4) reveals that in that case, OpenJPA with Derby embedded is 2.2 times less efficient than OpenJPA with H2 embedded.

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

Transaction/Retrieval SizeFew EntitiesMany EntitiesAverage Score
 OpenJPA
H2 embedded
OpenJPA
Derby embedded
OpenJPA
H2 embedded
OpenJPA
Derby embedded
OpenJPA
H2 embedded
OpenJPA
Derby embedded
Basic Person Test13.015.810.29.011.612.4
Element Collection Test2.51.13.43.53.02.3
Inheritance Test3.31.35.23.74.32.5
Indexing Test17.57.217.712.017.69.6
Graph (Binary Tree) Test3.01.23.01.13.01.2
Multithreading Test20.419.812.010.916.215.3
All Tests10.28.08.86.99.57.4

The results above show that in general OpenJPA with H2 embedded is slightly more efficient than OpenJPA with Derby embedded in performing JPA database operations.

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

Other Head to Head DBMS/JPA Comparisons