Modeshape in JBoss takes too long to initialize
souvikonline Feb 17, 2011 2:40 AMI have created a content repository for images which uses the JPA connector with PostreSQL as its backend. The images are uploaded through the Modeshape WebDAV interface running in JBoss.
This works great till I have to restart JBoss. With a mode:autoGenerateSchema="validate" configuration for the connector, JBoss starts as usual but it takes forever for the validation to complete. With a repository containing about 1000 JPEG files it takes more than 30 minutes before I can login to the repository again through the WebDAV interface. I would expect the validation to be limited to the schema which should not take so long.
I traced the hits to the database in Wireshark and could see many queries being executed all the while I was waiting for the repo to be available.
Following is the configuration for my repos:
<!--
Define the sources used by the repository (or repositories) to store
and access the content
-->
<mode:sources jcr:primaryType="nt:unstructured">
<mode:source jcr:name="content"
mode:classname="org.modeshape.connector.store.jpa.JpaSource"
mode:dialect="org.hibernate.dialect.PostgreSQLDialect"
mode:dataSourceJndiName="java:/RepositoryDS" mode:retryLimit="3"
mode:defaultWorkspaceName="photos" mode:autoGenerateSchema="validate" />
<!-- One source for the "/jcr:system" content ... -->
<mode:source jcr:name="SystemStore"
mode:classname="org.modeshape.connector.store.jpa.JpaSource"
mode:dialect="org.hibernate.dialect.PostgreSQLDialect"
mode:dataSourceJndiName="java:/RepositoryDS"
mode:defaultWorkspaceName="system" mode:autoGenerateSchema="validate" />
</mode:sources>
If I use mode:autoGenerateSchema="create" in the configuration instead, I am able to access the repo using WebDAV almost immediately after JBoss start, but then I will have to upload all the content all over again which again takes a long time.
I am using JBoss 5.1.0 GA with Modeshape 2.4 and PostgreSQL 8.3.
I also looked at the JBoss process in VisualVM and could see frequent GC happening with a max heap size of 512 MB while the validtion was happening. Increasing the max heap size to 1024 MB and setting the GC scheme to CMS the GC thrashing reduced, but still the heap fills up slowly and takes almost the same amount of time for validation to complete.
Any pointers on how to improve performance is highly appreciated.