You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Jukka Zitting (Created) (JIRA)" <ji...@apache.org> on 2011/11/02 20:57:32 UTC

[jira] [Created] (JCR-3137) Slow repository startup

Slow repository startup
-----------------------

                 Key: JCR-3137
                 URL: https://issues.apache.org/jira/browse/JCR-3137
             Project: Jackrabbit Content Repository
          Issue Type: Bug
          Components: jackrabbit-core
    Affects Versions: 2.3.2
            Reporter: Jukka Zitting


On my reasonably fast computer I'm seeing over 30 seconds to start up a new repository from scratch. The startup is much faster if the repository already exists, so this has something to do with the initial setup. Ideally a new empty repository should come up in no more than a few seconds.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (JCR-3137) Slow repository startup

Posted by "Jukka Zitting (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-3137?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13143881#comment-13143881 ] 

Jukka Zitting commented on JCR-3137:
------------------------------------

It looks like the main slowdown comes from some Derby startup stuff. If I run the loop only once (with default durability for Derby) I still get about 30s for the startup. With H2 it's massively faster.
                
> Slow repository startup
> -----------------------
>
>                 Key: JCR-3137
>                 URL: https://issues.apache.org/jira/browse/JCR-3137
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 2.3.2
>            Reporter: Jukka Zitting
>
> On my reasonably fast computer I'm seeing over 30 seconds to start up a new repository from scratch. The startup is much faster if the repository already exists, so this has something to do with the initial setup. Ideally a new empty repository should come up in no more than a few seconds.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (JCR-3137) Slow repository startup

Posted by "Jukka Zitting (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-3137?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13143484#comment-13143484 ] 

Jukka Zitting commented on JCR-3137:
------------------------------------

Here's some rough measurements over recent releases (time between "Starting repository" and "Repository started" messages from RepositoryImpl, plus the total repository size after the default install):

    1.6.5: install 19s, restart 2s, size 4.0MB
    2.0.5: install 20s, restart 3s, size 4.2MB
    2.1.6: install 21s, restart 4s, size 4.2MB
    2.2.9: install 29s, restart 3s, size 6.2MB
    2.3.2: install 29s, restart 4s, size 6.3MB

Not sure what's taking up so much time in the initial install, perhaps it's the time taken by Derby to create the initial databases. Perhaps H2 would be faster?
                
> Slow repository startup
> -----------------------
>
>                 Key: JCR-3137
>                 URL: https://issues.apache.org/jira/browse/JCR-3137
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 2.3.2
>            Reporter: Jukka Zitting
>
> On my reasonably fast computer I'm seeing over 30 seconds to start up a new repository from scratch. The startup is much faster if the repository already exists, so this has something to do with the initial setup. Ideally a new empty repository should come up in no more than a few seconds.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (JCR-3137) Slow repository startup

Posted by "Thomas Mueller (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-3137?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13143862#comment-13143862 ] 

Thomas Mueller commented on JCR-3137:
-------------------------------------

I made a simple test and got 4.3 seconds (cold, meaning classes are not loaded yet) to create a repository. I ran a few tests and I found H2 is about 3 times faster for my test case. I ran each test 3 times and took the best numbers (all numbers are milliseconds; lower is faster).

Test case and results also available at http://h2database.com/p.html#cd90256a98e4ec14d9ca9d3f1c601a65

org.apache.jackrabbit.core.persistence.pool.DerbyPersistenceManager
(default derby.system.durability)
4365 ms: test #0 delete
642 ms: test #1 reuse
1740 ms: test #2 delete
272 ms: test #3 reuse
1462 ms: test #4 delete
411 ms: test #5 reuse
1650 ms: test #6 delete
268 ms: test #7 reuse
1329 ms: test #8 delete
313 ms: test #9 reuse
12684 total

org.apache.jackrabbit.core.persistence.pool.DerbyPersistenceManager
System.setProperty("derby.system.durability", "test");
3872 ms: test #0 delete
627 ms: test #1 reuse
1179 ms: test #2 delete
315 ms: test #3 reuse
834 ms: test #4 delete
402 ms: test #5 reuse
950 ms: test #6 delete
249 ms: test #7 reuse
791 ms: test #8 delete
274 ms: test #9 reuse
9730 total

org.apache.jackrabbit.core.persistence.pool.H2PersistenceManager
jdbc:h2:${rep.home}/version/db;create=true
2096 ms: test #0 delete
415 ms: test #1 reuse
417 ms: test #2 delete
341 ms: test #3 reuse
407 ms: test #4 delete
339 ms: test #5 reuse
462 ms: test #6 delete
368 ms: test #7 reuse
403 ms: test #8 delete
338 ms: test #9 reuse
5634 total

org.apache.jackrabbit.core.persistence.pool.H2PersistenceManager
jdbc:h2:${rep.home}/version/db;create=true;log=0;file_lock=fs
(log=0 means disable the transaction log - similar to derby.system.durability;
file_lock=fs means use a file lock instead of a .lock.db file)
1908 ms: test #0 delete
249 ms: test #1 reuse
214 ms: test #2 delete
171 ms: test #3 reuse
172 ms: test #4 delete
165 ms: test #5 reuse
224 ms: test #6 delete
147 ms: test #7 reuse
220 ms: test #8 delete
121 ms: test #9 reuse
3637 total

Test case:

import java.io.File;
import javax.jcr.Node;
import javax.jcr.Repository;
import javax.jcr.Session;
import javax.jcr.SimpleCredentials;
import org.apache.commons.io.FileUtils;
import org.apache.jackrabbit.core.TransientRepository;

public class Test {

    public static void main(String... args) throws Exception {
        System.setProperty("derby.system.durability", "test");
        long start = System.currentTimeMillis();
        for (int i = 0; i < 10; i++) {
            boolean delete = i % 2 == 0;
            if (delete) {
                FileUtils.deleteDirectory(new File("repository"));
            }
            long time = System.currentTimeMillis();
            Repository repository = new TransientRepository();
            Session session = repository.login(
                    new SimpleCredentials(
                            "admin", "admin".toCharArray()));
            try {
                if (session.getRootNode().hasNode("test")) {
                    session.getRootNode().getNode("test").remove();
                }
                Node test = session.getRootNode().addNode("test");
                session.save();
                test.addNode("x");
                session.save();
            } finally {
                session.logout();
            }
            System.out.println((System.currentTimeMillis() - time) +
                    " ms: test #" + i + " " + (delete ? "delete" : "reuse"));
        }
        System.out.println((System.currentTimeMillis() - start) + " total");
    }

}



                
> Slow repository startup
> -----------------------
>
>                 Key: JCR-3137
>                 URL: https://issues.apache.org/jira/browse/JCR-3137
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 2.3.2
>            Reporter: Jukka Zitting
>
> On my reasonably fast computer I'm seeing over 30 seconds to start up a new repository from scratch. The startup is much faster if the repository already exists, so this has something to do with the initial setup. Ideally a new empty repository should come up in no more than a few seconds.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira