Message:
A new issue has been created in JIRA.
---------------------------------------------------------------------
View the issue:
http://objectstyle.org/jira/secure/ViewIssue.jspa?key=CAY-438
Here is an overview of the issue:
---------------------------------------------------------------------
Key: CAY-438
Summary: Performance problem 1.2 (object create and commit)
Type: Improvement
Status: Assigned
Priority: Critical
Project: Cayenne
Components:
Cayenne Core Library
Versions:
1.2 [DEV]
Assignee: Andrus Adamchik
Reporter: Florian Eska
Created: Mon, 6 Feb 2006 3:07 AM
Updated: Mon, 6 Feb 2006 3:07 AM
Environment: DB: Database 10g Enterprise Edition Release 10.2.0.1.0
JVM: 1.5.0_05-b05
Operating System: Windows XP
JVM: 1.5.0_05-b04
Operating System: SunOS 5.10
Description:
Object Creation and Commit Performance:
During object creation we see significant performance diffrences between the cayenne 1.1 and cayenne 1.2 M10 version.
The version 1.2. seems to us that it is 3 to 5 time slower than cayenne 1.1.
Our application fill the database with a great number of objects, so a
import run needs with version 1.2.
To show the problem we produce a sample code. The code needs for 1000
objects with
cayenne 1.1 3562 milliseconds
and
cayenne 1.2M10 17781 milliseconds
Profiling of the application show us that in version 1.2 most of the
creation time is spent inside
org.objectstyle.cayenne.util.IDUtil.pseudoUniqueByteSequence16()
The call
org.objectstyle.cayenne.access.DataContext.createAndRegisterNewObject(Class)
is up to 6 time slower in the 1.2 implementation.
Also it show us that for 40 commits the code 1.2 is 500 ms times slower than 1.1.
This is for us also important, because we want do 7000 commits per business operation. So we will lost 1.20 minutes during commit.
We have Netbeans profiling files for our application for a cayenne version 1.1 and 1.2 m10. So these files can be send on request.
Notes from Ingo Feulner:
One of the reasons for the bad performance of the first
implementation is the use of Thread.sleep(1).
The spec only gurantees a delay for AT LEAST the given period. But
most VM implementations of Thread.sleep are working only
with an accuracy of 10ms... depending on the systems settings and
according to our Sun consultant it is even worse on Sun machines (up
to 50ms).
Here's a backtrace of our testcase running on a Sun SPARC machine
(this shows that the VM is mostly in Thread.sleep(), so the CPU is
actually doing nothing... no load)
Full thread dump Java HotSpot(TM) Server VM (1.5.0_04-b05 mixed mode):
"FileListener-XML Import" daemon prio=10 tid=0x008bfd08 nid=0x18
waiting on
condition [0xd1f7f000..0xd1f7fa90]
at java.lang.Thread.sleep(Native Method)
at
org.objectstyle.cayenne.util.IDUtil.pseudoUniqueByteSequence16
(IDUtil.java:152)
- locked <0xf59aa7e0> (a java.security.MessageDigest$Delegate)
at org.objectstyle.cayenne.ObjectId.<init>(ObjectId.java:120)
at
org.objectstyle.cayenne.access.DataContext.registerNewObjectWithEntity
(DataContext.java:882)
at
org.objectstyle.cayenne.access.DataContext.createAndRegisterNewObject
(DataContext.java:
[...]
Have you tried the RMI implementation to generate UUIDs? Maybe
someone here does know about another very fast UUID algorithm... as
this is used for every object creation...
Example code:
public void testClientCommit() throws Exception
{
long start = System.currentTimeMillis();
try
{
DataContext context = DataContext.createDataContext();
Date date = new Date();
for (int i = 0; i < 1000; i++)
{
Client client = (Client)
context.createAndRegisterNewObject(Client.class);
client.setCondition("i");
client.setCreated(date);
client.setCreatedBy("Test");
client.setName("Test Run"+i);
context.commitChanges();
}
}
catch (IllegalStateException e)
{
e.printStackTrace();
throw e;
}
catch (CayenneRuntimeException e)
{
e.printStackTrace();
throw e;
}
finally
{
long end = System.currentTimeMillis();
System.out.println("testClientCommit needs "+ (end-start)
+ " ms!");
}
}
---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
http://objectstyle.org/jira/secure/Administrators.jspa
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
This archive was generated by hypermail 2.0.0 : Mon Feb 06 2006 - 03:07:38 EST