You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Andrus Adamchik (JIRA)" <ji...@apache.org> on 2010/07/23 13:58:49 UTC

[jira] Closed: (CAY-1468) Commit performance degradation

     [ https://issues.apache.org/jira/browse/CAY-1468?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrus Adamchik closed CAY-1468.
--------------------------------

    Fix Version/s: 3.0.1
       Resolution: Fixed

> Commit performance degradation
> ------------------------------
>
>                 Key: CAY-1468
>                 URL: https://issues.apache.org/jira/browse/CAY-1468
>             Project: Cayenne
>          Issue Type: Bug
>          Components: Core Library
>    Affects Versions: 3.0
>            Reporter: Cosmin Marian
>             Fix For: 3.0.1
>
>
> While developing an application using Cayenne I noticed that the
> performance of  DataContext.commitChanges()  degrades with the number of
> commits done.
> To be more specific, I have a model with two entities: Result and
> ResultStream, with a many to one relation from Result to ResultStream.
> The test I do is simple: I generate a lot of Result objects, all linked to
> the same ResultStream and I call commit after each Result added to the
> DataContext and measure the time it takes to perform the commit. I notice
> that this time grows fairly linear. Of course, the growth is noticeably
> after generating many results
> Here is the source code of the test:
> public class Main {
>     public static void main(String[] args) {
>         DataContext dc = DataContext.createDataContext();
>         final int stepSize = 500;
>         final int nbSteps = 50;
>         SelectQuery sq = new SelectQuery(ResultStream.class);
>         ResultStream rs = (ResultStream) dc.performQuery(sq).get(0);
>         StopWatch sw = new StopWatch();
>         sw.start();
>         for (int i = 1; i <= nbSteps * stepSize; ++i) {
>             Result t = new Result();
>             t.setValue(i);
>             t.setResultStream(rs);
>             dc.commitChanges();
>             if (i % stepSize == 0) {
>                 sw.stop();
>                 System.out.printf("%6d, %s, %5d\n", i,
> DurationFormatUtils.formatDurationHMS(sw.getTime()),
> sw.getTime());
>                 sw.reset();
>                 sw.start();
>             }
>         }
>     }
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.