openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Pflueger <>
Subject Speed of fetching simple entities using OpenJPA
Date Mon, 12 Sep 2011 18:36:15 GMT
I compared JDBC and OpenJPA speed of fetching simple entities (consisting only of a single
ID attribute). The speed difference seems quite severe.

With JDBC, I can read 2 million entities in about 3 seconds when OS/DB caches are warm.
With OpenJPA using slice (a single slice), it takes a bit above 30 seconds, so about ten times
as long, more than I would expect.
Using a direct connection without slice reduces this time to about 24 seconds, ~8 times as
much as the JDBC version.

In the JDBC test I also create objects from the rows, so both tests include object creation
overhead of the entities (plus a sum calculation of the IDs).

I'm doing this test using PostgreSQL and an up to date OpenJPA 2.2 snapshot.
Entities are enhanced using javaagent enhancement.

I tried optimizing OpenJPA performance with:
      <property name="openjpa.ConnectionRetainMode" value="always"></property>
      <property name="openjpa.ProxyManager" value="TrackChanges=false"/>
      <property name="openjpa.IgnoreChanges" value="true"/>
      <property name="openjpa.LockManager" value="none"/>
      <property name="openjpa.DetachState" value="fetch-groups(DetachedStateField=false)"/>

But those didn't seem to affect performance in any significant way.

Now, is such a large performance hit expected, and what would be the reason?
It would be nice if some performance numbers like these would be in the documentation, by
the way, to be better able to judge for what applications OpenJPA can be used/what performance
penalties one has to expect, depending on the situation.


SMA Solar Technology AG
Aufsichtsrat: Guenther Cramer (Vorsitzender)
Vorstand: Juergen Dolle, Roland Grebe, Uwe Hertel, Pierre-Pascal Urbon, Marko Werner
Handelsregister: Amtsgericht Kassel HRB 3972
Sitz der Gesellschaft: 34266 Niestetal
USt-ID-Nr. DE 113 08 59 54
WEEE-Reg.-Nr. DE 95881150

View raw message