Bug 340359 - Poor Performance with Batch Writing
Summary: Poor Performance with Batch Writing
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: Other Linux
: P2 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
Depends on:
Blocks:
 
Reported: 2011-03-17 14:20 EDT by Daniel Lo CLA
Modified: 2022-06-09 10:04 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Lo CLA 2011-03-17 14:20:50 EDT
Build Identifier: Eclipse Persistence Services - 2.1.2.v20101206-r8635

With eclipselink.jdbc.batch-writing=Oracle-JDBC specified, but without eclipselink.jdbc.batch-writing.size=nnn specified in persistence.xml, and if the EntityManager.flush() and clear() are invoked periodically within the transaction, the performance of 50,000 inserts dropped from 7.2 seconds to 92.6 seconds.  If we add eclipselink.jdbc.batch-writing.size=100, or if we remove EntityManager.flush() and clear(), then the performance was back to 7.2 seconds for 50,000 inserts.

See http://myforums.oracle.com/jive3/thread.jspa?threadID=746003&tstart=0 for more information.

Reproducible: Always

Steps to Reproduce:
1. persistence.xml contains eclipselink.jdbc.batch-writing=Oracle-JDBC but without eclipselink.jdbc.batch-writing.size=nnn 
2. persist 50,000 entities in a loop
3. invoke EntityManager.flush() and clear() after every 10 inserts
Comment 1 Tom Ware CLA 2011-04-06 08:28:32 EDT
Setting target and priority.  See the following page for the meanings of these fields:

http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines

Community: Please vote for this bug if it is important to you.  Votes are one of the main criteria we use to determine which bugs to fix next.
Comment 2 Chris Delahunt CLA 2011-04-26 14:49:21 EDT
Issue described in the forum post is not exactly what is described in the bug.  The bug should be to investigate the claim that adding a flush +clear  to a loop drastically decreases performance compared to setting the batch writing mechanism size to the same interval.  Ie
if batchsize =100 

For (int id=1; id<100000; id++{
em.persist(new Employee(id));
if (id % batchsize==0){
  em.flush();
  em.clear();
}
}

The above needs to be investigated and compared with 
For (int id=1; id<100000; id++{
em.persist(new Employee(id));
}
To see if there is a performance decrease and if it is due to the em.flush and em.clear calls or some configuration option.
Comment 3 Eclipse Webmaster CLA 2022-06-09 10:04:06 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink