• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JPA and JDBC, Which one is Performance efficient

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I am working on an application that needs to be highly performance efficient. We will be having heavy data stored in data bases. And will be having hundreds of requests per minute and for each request will interact with database.

Now JPA ease us from writing SQL and many more, but in this sceneraio, will JPA be that efficient as it adds an extra layer over the JDBC and generates SQL which we can write directly?

Also we have another module that heavily communicates with database, will JPA be performance efficient or JDBC in this case?

Thanks
 
Ranch Hand
Posts: 553
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Most JPA providers are highly optimized and provide many performance features such as caching, batch writing, sequence preallocation, batch fetching, parametrized SQL and many others.

If you had perfectly optimized JDBC and application code, and cached any cacheable data yourself, and took full advantage of every optimization offered by your JDBC driver and database, then you would have better performance than JPA. However most applications are not perfectly optimized, and the more complex the application to more likely the issues. JPA allows easy configuration and optimization of a persistent application, which can lead to better performance. JPA also allows you to spend less time on persistence, so you have more time to spend optimizing your application.

Your performance requirements do not seem like much, so I don't see any issue in using JPA.
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Shayan Shah wrote:Also we have another module that heavily communicates with database, will JPA be performance efficient or JDBC in this case?Thanks


Impossible to tell. It depends on the requirements of the application.

It is possible to write good/bad JPA and good/bad JDBC. It's hard to compare properly.
 
Ranch Hand
Posts: 339
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm also very interested in this topic.

I would like to kindly ask you about JPA performance myself, particularly about the EclipseLink implementation. The Question is: Is it normal for an Entity Manager to go to sleep so to speak. The scenario I'm worried about is related to that, I noticed that If I leave the Container (OC4J in this case) inactive for a long period of time and then suddenly make an Insert operation, it takes way too long. Checking the Container Console shows that apparently the Resource(Entity Manager) is instantiated again after a long period of inactivity, and this causes a huge delay.

Is this a big concern for a production environment ?

Thanks,

Jose.
 
reply
    Bookmark Topic Watch Topic
  • New Topic