Compare with

Comparison of OpenJPA with H2 server vs OpenJPA 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 server
OpenJPA
MySQL server
OpenJPA
H2 server
OpenJPA
MySQL server
OpenJPA
H2 server
OpenJPA
MySQL server
Basic Person Test3.73.92.21.62.92.7
Element Collection Test2.61.61.50.682.11.1
Inheritance Test4.53.62.01.43.22.5
Indexing Test7.35.63.62.45.44.0
Graph (Binary Tree) Test1.10.680.840.570.970.63
Multithreading Test7.77.24.22.75.94.9
All Tests4.53.72.41.53.42.6

The results above show that in general OpenJPA with H2 server is more efficient than OpenJPA with MySQL server in persisting JPA entity objects to the database.

A large performance gap has been detected when using JPA element collections with large transaction size. Comparing the normalized speed of OpenJPA with MySQL database server (0.68) to the normalized speed of OpenJPA with H2 database server (1.5) reveals that in that case, OpenJPA with H2 server is 2.2 times faster than OpenJPA with MySQL server.

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
H2 server
OpenJPA
MySQL server
OpenJPA
H2 server
OpenJPA
MySQL server
OpenJPA
H2 server
OpenJPA
MySQL server
Basic Person Test2.93.27.622.75.212.9
Element Collection Test0.00220.00381.92.90.931.4
Inheritance Test0.0130.0174.06.92.03.4
Indexing Test4.12.48.823.46.512.9
Graph (Binary Tree) Test0.380.270.490.350.440.31
Multithreading Test5.90.1414.018.110.09.1
All Tests2.21.06.112.44.26.7

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

A large performance gap has been detected when using simple basic entities with large retrieval size. Comparing the normalized speed of OpenJPA with H2 database server (7.6) to the normalized speed of OpenJPA with MySQL database server (22.7) reveals that in that case, OpenJPA with MySQL server is 3.0 times faster than OpenJPA with H2 server.

On the other hand, OpenJPA with MySQL server is slower, for instance, when using multithreading with small retrieval size. Comparing the normalized speed of OpenJPA with MySQL database server (0.14) to the normalized speed of OpenJPA with H2 database server (5.9) reveals that in that case, OpenJPA with MySQL server is 42.1 times slower than OpenJPA with H2 server.

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
H2 server
OpenJPA
MySQL server
OpenJPA
H2 server
OpenJPA
MySQL server
OpenJPA
H2 server
OpenJPA
MySQL server
Basic Person Test3.79.31.02.22.45.8
Element Collection Test2.04.81.21.11.62.9
Inheritance Test2.81.51.10.902.01.2
Indexing Test3.80.317.52.15.71.2
Multithreading Test0.981.91.00.991.01.4
All Tests2.73.62.41.52.52.5

The results above show that in general OpenJPA with H2 server is equivalent to OpenJPA 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 OpenJPA with MySQL database server (0.31) to the normalized speed of OpenJPA with H2 database server (3.8) reveals that in that case, OpenJPA with H2 server is 12.3 times faster than OpenJPA with MySQL server.

On the other hand, OpenJPA with H2 server is slower, for instance, when using simple basic entities with small retrieval size. Comparing the normalized speed of OpenJPA with H2 database server (3.7) to the normalized speed of OpenJPA with MySQL database server (9.3) reveals that in that case, OpenJPA with H2 server is 2.5 times slower than OpenJPA with MySQL server.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
H2 server
OpenJPA
MySQL server
OpenJPA
H2 server
OpenJPA
MySQL server
OpenJPA
H2 server
OpenJPA
MySQL server
Basic Person Test3.00.742.01.62.51.2
Element Collection Test0.00780.0141.91.70.940.87
Inheritance Test0.0340.0482.82.01.41.0
Indexing Test2.80.743.23.03.01.9
Graph (Binary Tree) Test0.790.450.430.250.610.35
Multithreading Test7.00.552.52.94.81.7
All Tests2.30.422.11.92.21.2

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

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

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
H2 server
OpenJPA
MySQL server
OpenJPA
H2 server
OpenJPA
MySQL server
OpenJPA
H2 server
OpenJPA
MySQL server
Basic Person Test3.20.982.21.72.71.4
Element Collection Test0.00600.00990.880.650.440.33
Inheritance Test0.0300.0333.11.51.60.75
Indexing Test6.50.643.62.05.11.3
Graph (Binary Tree) Test0.730.410.750.430.740.42
Multithreading Test7.60.275.22.96.41.6
All Tests3.00.392.61.52.80.96

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

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

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

Transaction/Retrieval SizeFew EntitiesMany EntitiesAverage Score
 OpenJPA
H2 server
OpenJPA
MySQL server
OpenJPA
H2 server
OpenJPA
MySQL server
OpenJPA
H2 server
OpenJPA
MySQL server
Basic Person Test3.33.63.06.03.14.8
Element Collection Test0.931.31.51.41.21.3
Inheritance Test1.51.02.62.52.01.8
Indexing Test4.91.95.46.65.14.3
Graph (Binary Tree) Test0.750.450.630.400.690.43
Multithreading Test5.92.05.45.55.63.8
All Tests2.91.83.23.93.02.8

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

A large performance gap has been detected when using multithreading with small transaction/retrieval size. Comparing the normalized speed of OpenJPA with MySQL database server (2.0) to the normalized speed of OpenJPA with H2 database server (5.9) reveals that in that case, OpenJPA with H2 server is 3.0 times faster than OpenJPA with MySQL server.

On the other hand, OpenJPA with H2 server is slower, for instance, when using simple basic entities with large transaction/retrieval size. Comparing the normalized speed of OpenJPA with H2 database server (3.0) to the normalized speed of OpenJPA with MySQL database server (6.0) reveals that in that case, OpenJPA with H2 server is 2.0 times slower than OpenJPA with MySQL server.

Other Head to Head DBMS/JPA Comparisons