Comparison of OpenJPA with MySQL server vs Hibernate with MySQL server

From: http://www.jpab.org/OpenJPA/MySQL/server/Hibernate/MySQL/server.html

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







Transaction Size => Few Entities Many Entities Average Score   OpenJPAMySQL server HibernateMySQL server OpenJPAMySQL server HibernateMySQL server OpenJPAMySQL server HibernateMySQL server Basic Person Test Element Collection Test Inheritance Test Indexing Test Graph (Binary Tree) Test Multithreading Test All Tests
3.9 3.6 1.6 1.6 2.7 2.6
1.6 1.6 0.68 0.72 1.1 1.1
3.6 3.7 1.4 1.6 2.5 2.7
5.6 5.4 2.4 2.6 4.0 4.0
0.68 1.5 0.57 1.2 0.63 1.4
7.2 7.4 2.7 2.9 4.9 5.2
3.7 3.9 1.5 1.8 2.6 2.8

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

A large performance gap has been detected when using graphs of objects with small transaction size. Comparing the normalized speed of OpenJPA with MySQL database server (0.68) to the normalized speed of Hibernate with MySQL database server (1.5) reveals that in that case, Hibernate with MySQL 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 Entities Many Entities Average Score   OpenJPAMySQL server HibernateMySQL server OpenJPAMySQL server HibernateMySQL server OpenJPAMySQL server HibernateMySQL server Basic Person Test Element Collection Test Inheritance Test Indexing Test Graph (Binary Tree) Test Multithreading Test All Tests
3.2 3.0 22.7 11.0 12.9 7.0
0.0038 0.34 2.9 1.2 1.4 0.79
0.017 1.3 6.9 14.5 3.4 7.9
2.4 2.5 23.4 12.8 12.9 7.6
0.27 0.55 0.35 0.71 0.31 0.63
0.14 0.23 18.1 13.8 9.1 7.0
1.0 1.3 12.4 9.0 6.7 5.2

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

A large performance gap has been detected when using JPA element collections with large retrieval size. Comparing the normalized speed of Hibernate with MySQL database server (1.2) to the normalized speed of OpenJPA with MySQL database server (2.9) reveals that in that case, OpenJPA with MySQL server is 2.4 times faster than Hibernate with MySQL server.

On the other hand, OpenJPA with MySQL server is slower, for instance, when using JPA element collections with small retrieval size. Comparing the normalized speed of OpenJPA with MySQL database server (0.0038) to the normalized speed of Hibernate with MySQL database server (0.34) reveals that in that case, OpenJPA with MySQL server is 89.5 times slower than Hibernate with MySQL server.

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







Retrieval Size => Few Entities Many Entities Average Score   OpenJPAMySQL server HibernateMySQL server OpenJPAMySQL server HibernateMySQL server OpenJPAMySQL server HibernateMySQL server Basic Person Test Element Collection Test Inheritance Test Indexing Test Multithreading Test All Tests
9.3 10.0 2.2 2.0 5.8 6.0
4.8 6.7 1.1 0.53 2.9 3.6
1.5 2.8 0.90 1.6 1.2 2.2
0.31 0.44 2.1 2.0 1.2 1.2
1.9 2.1 0.99 0.98 1.4 1.5
3.6 4.4 1.5 1.4 2.5 2.9

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

On the other hand, Hibernate with MySQL server is slower, for instance, when using JPA element collections with large retrieval size. Comparing the normalized speed of Hibernate with MySQL database server (0.53) to the normalized speed of OpenJPA with MySQL database server (1.1) reveals that in that case, Hibernate with MySQL server is 2.1 times slower than OpenJPA with MySQL server.

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







Transaction Size => Few Entities Many Entities Average Score   OpenJPAMySQL server HibernateMySQL server OpenJPAMySQL server HibernateMySQL server OpenJPAMySQL server HibernateMySQL server Basic Person Test Element Collection Test Inheritance Test Indexing Test Graph (Binary Tree) Test Multithreading Test All Tests
0.74 0.73 1.6 1.6 1.2 1.2
0.014 0.39 1.7 1.2 0.87 0.78
0.048 0.61 2.0 2.1 1.0 1.4
0.74 0.81 3.0 2.6 1.9 1.7
0.45 0.69 0.25 0.40 0.35 0.54
0.55 0.63 2.9 3.0 1.7 1.8
0.42 0.64 1.9 1.8 1.2 1.2

The results above show that in general Hibernate with MySQL server is equivalent to OpenJPA with MySQL server in updating JPA entity objects in the database.

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

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







Transaction Size => Few Entities Many Entities Average Score   OpenJPAMySQL server HibernateMySQL server OpenJPAMySQL server HibernateMySQL server OpenJPAMySQL server HibernateMySQL server Basic Person Test Element Collection Test Inheritance Test Indexing Test Graph (Binary Tree) Test Multithreading Test All Tests
0.98 1.1 1.7 1.7 1.4 1.4
0.0099 0.21 0.65 0.53 0.33 0.37
0.033 0.65 1.5 1.8 0.75 1.2
0.64 0.81 2.0 2.0 1.3 1.4
0.41 0.55 0.43 0.62 0.42 0.58
0.27 0.35 2.9 4.1 1.6 2.2
0.39 0.61 1.5 1.8 0.96 1.2

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

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

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







Transaction/Retrieval Size Few Entities Many Entities Average Score   OpenJPAMySQL server HibernateMySQL server OpenJPAMySQL server HibernateMySQL server OpenJPAMySQL server HibernateMySQL server Basic Person Test Element Collection Test Inheritance Test Indexing Test Graph (Binary Tree) Test Multithreading Test All Tests
3.6 3.7 6.0 3.6 4.8 3.6
1.3 1.8 1.4 0.84 1.3 1.3
1.0 1.8 2.5 4.3 1.8 3.1
1.9 2.0 6.6 4.4 4.3 3.2
0.45 0.83 0.40 0.73 0.43 0.78
2.0 2.1 5.5 5.0 3.8 3.6
1.8 2.1 3.9 3.2 2.8 2.7

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

猜你喜欢

转载自coffeehot.iteye.com/blog/2112181