[ 
https://issues.apache.org/jira/browse/JCR-1253?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12551458
 ] 

Thomas Mueller commented on JCR-1253:
-------------------------------------

Hi,

I think performance is important, but I am not sure if keeping autocommit off 
will help. I have tested it using 
org.apache.jackrabbit.core.persistence.bundle.DerbyPersistenceManager and the 
trunk. Removing setAutoCommit didn't have an effect on performance on my 
machine. Sometimes it is slower, sometimes faster. My results are:

with setAutoCommit(true):
3640
4688
4250
3672
3672
total: 19922

without:
3813
4687
4766
4281
3906
total: 21453

(So in this case, it was actually slower with the change)

Test case:
public class TestStore {
    public static void main(String[] args) throws Exception {
        Repository repository = (Repository) new TransientRepository();
            Credentials credentials = new SimpleCredentials("admin", "admin"
                    .toCharArray());
        Session session = repository.login(credentials);
        Node testNode = session.getRootNode().addNode("testNode");
        session.save();
        long start = System.currentTimeMillis();
        for(int j = 0; j < 5; j++) {
            long time = System.currentTimeMillis();
            for (int i = 0; i < 100; i++) {
                testNode.setProperty("int", i);
                testNode.save();
            }
            System.out.println(System.currentTimeMillis() - time);
        }
        System.out.println("total: " + (System.currentTimeMillis() - start));
        testNode.remove();
        session.save();
        session.logout();
    }
}

> Allow to configure autoCommit mode for BundleDB PM to avoid extra overhead 
> when working in non clustered environment
> --------------------------------------------------------------------------------------------------------------------
>
>                 Key: JCR-1253
>                 URL: https://issues.apache.org/jira/browse/JCR-1253
>             Project: Jackrabbit
>          Issue Type: Improvement
>          Components: jackrabbit-core
>    Affects Versions: 1.3.3, 1.4
>            Reporter: Przemo Pakulski
>            Priority: Minor
>             Fix For: 1.4
>
>         Attachments: single_checkin.JPG, small_change_log.JPG
>
>
> BundleDB PMs keeps connection open in autoCommit mode and during every store 
> operation turn off/on this flag introducing some overhead.
> '... the reason is that in a clustered environment, the 'select' statements
> must be committed as well,  otherwise the tables remain locked. and
> instead of explicitly commit each time after a read, we used the
> autocommit as default and switch it off during store ...'
> We could add additional parameter which allows to configure autoCommit mode, 
> by default it could work as before, but specifing additional parameter will 
> change the behaviour.
> It's hard to say about exact numbers how much overhead it is, there are to 
> many variables (network speed/latency, db server type, jdbc driver, change 
> log size). For sure it means 2 extra network calls, which could be easily 
> avoided.
> See attached example screen from JProfiler using MSSQL server, and small 
> change logs; overhead is about 20%. Doing simple checkin on versionable node 
> it could be even 40%.

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

Reply via email to