Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Performance questions EclipseLink vs. Hibernate

If you are at all concerned about performance you must use weaving, it can
make a major performance difference.

To use weaving you must use the EclipseLink agent JVM option, or use static
weaving, or be in an EJB3 compliant server.

Without weaving EclipseLink does not support lazy OneToOne or ManyToOne
relationships, and also does not use attribute change tracking.  Without
weaving "deferred" change tracking is used, which requires making a backup
copy to track changes.  Making this backup copy can be both expensive, and
use extra memory.

Your memory error could mean you are pretty low on memory in general, and
are barely scraping through in either cases, and should try increasing your
JVM memory size.  Otherwise something really un-usual could be occurring
cause the memory issue.  This would be more difficult to determine, perhaps
include more information on the Product object.

Leon Derks-2 wrote:
> Hello James,
> db = oracle xe 10.2.0
> os= win xp
> jvm = Java 6
> server tomcat 6.16
> jdbc = Oracle JDBC Driver version - ""
> I don't use <property name="" value="true"> or 
> static weaving.
> But why is this needed? What is the difference?
> Are objects not lazy loaded when no weaving is enabled, but is the full 
> object graph loaded? Does weaving also influence performance when 
> persisting objects?
> I have added the property: <property 
> name="eclipselink.jdbc.batch-writing" value="Oracle-JDBC"/>in
> But noticed no performance difference. I'm still getting a 
> "java.lang.OutOfMemoryError: Java heap space".
> I have not a security manager set in my JVM. I use a default jvm without 
> configurations.
> In my persisting case, I'm looping through a List of entities and 
> persist them one by one.
> After the loop I try to commit the transaction, but get a 
> "java.lang.OutOfMemoryError: Java heap space".
> Like this
> importedData = (Import) unmarshaller.unmarshal("huge xml file of size 
> 10-50MB")
> entityManager.getTransaction().begin();
> for(Product product : importedData.getProducts) {
>     //product is a deep object graph with objects.
>     entityManager.persist(product);
> }
> entityManager.getTransaction().commit();
> The strange thing is that it works with hibernate.
> Leon
> James Sutherland wrote:
>> This is very very odd, in our extensive performance testing we have done
>> comparing with Hibernate we have greatly exceed their performance is
>> almost
>> every possible usecase we have tested.  Could you please include more
>> details on exactly what your test is doing and exactly what your
>> environment
>> is (db, os, jvm, server, jdbc).
>> My guess is you issue is related one of the following,
>> 1 - You do not have weaving enabled in EclipseLink.  EclipseLink requires
>> this to do lazy loading and change tracking.  You must enable weaving
>> either
>> through the agent, or static weaver.
>> 2 - If using Oracle Hibernate enabled batch writing by default, where as
>> you
>> must turn in on in EclipseLink through a persistence property.
>> 3 - Do you have a security manager set in your jvm?  There is a setting
>> you
>> need to set currently for this in EclipseLink.
>> Leon Derks-2 wrote:
>>> Hello,
>>> Today we noticed differences in performance between EclipseLink and 
>>> Hibernate.
>>> We had made up a test case with a big list of objects(Entities). Each 
>>> Enitity has references to other Entities / list of Entities.
>>> Some of these Entities are shared and others are new.
>>> To save one Entity from the main list took about 780 milliseconds to 
>>> persist the whole Object graph into the db.
>>> There was not much difference between EclipseLink and Hibernate in this 
>>> case.
>>> But when we iterated through the big list of entities and persisted them 
>>> one by one, there was a big difference between EclipseLink and
>>> Hibernate.
>>> We tried one transaction for the whole list and also a single 
>>> transaction per Entity in the list.
>>> Hibernate succeeded in every case and was much faster then EclipseLink 
>>> (sometimes 50% faster).
>>> EclipseLink only succeeded when saving one Entity per transaction, 
>>> during the other cases (saving the whole list of objects in one 
>>> transaction) we did get "java.lang.OutOfMemoryError: Java heap space".
>>> EclipseLink used almost 15 minutes to complete and Hibernate did the 
>>> same in 9 minutes.
>>> Based on our results we would go for Hibernate at the moment. But are 
>>> there ways to speed up performance in EclipseLink?
>>> Why is there so much difference in performance between Hibernate and 
>>> EclipseLink.
>>> Leon

--- James Sutherland
 EclipseLink ,
Wiki: EclipseLink , TopLink 
Forums: TopLink , EclipseLink 
Book: Java Persistence 
View this message in context:
Sent from the EclipseLink - Users mailing list archive at

Back to the top