[jboss-user] [EJB 3.0] - Read lot of objects with OPTIMISTIC Locking scheme
apdo
do-not-reply at jboss.com
Sat Dec 6 22:29:14 EST 2008
I know that EJB are not used to retrieve very long list of objects.
However I have performed a simple test and I would like to confirm with you that result are obtained from correct configuration.
Objects:
Account entity with parameters id, username, realname, password
Role entity with parameters id, name, description
There is a relation m to n between Account and Role
Configuration:
| Persistence.xml
| <persistence>
| <persistence-unit name="securityEJB3">
| <jta-data-source>java:/securityEJB3DS</jta-data-source>
| <properties>
| <property name="hibernate.hbm2ddl.auto" value="update"/>
| <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"/>
| <property name="hibernate.show_sql" value="true"/>
| <property name="hibernate.cache.use_query_cache" value="true"/>
| <property name="hibernate.cache.provider_class" value="org.jboss.ejb3.entity.TreeCacheProviderHook" />
| <property name="hibernate.treecache.mbean.object_name" value="jboss.cache:service=EJB3EntityTreeCache" />
| </properties>
| </persistence-unit>
| </persistence>
|
To enable caching on the default configuration, I follow the french instruction provided in at the following location:
http://wiki.objetdirect.com/wiki/index.php?title=Cache_2nd_niveau_Hibernate
Ejb3-entity-cache-service.xml
| <attribute name="NodeLockingScheme">OPTIMISTIC</attribute>
| <attribute name="IsolationLevel">REPEATABLE_READ</attribute>
| <attribute name="CacheMode">LOCAL</attribute>
|
| Everything else is left to the default values
|
Test Results:
100000 Account and 100 role have been inserted.
For test 2 and 3:
Retrieving all Account using a entityManager.createQuery("from Account a") it takes
Test 1:
Simple select from SQL server management studio.
It take 1 second to display the whole list of Account
Test 2:
With pessimistic locking:
PESSIMISTIC
About 10 second for the first call and then about 4 seconds using the cache
Test 3:
Thisi test has been executed with optimistic locking enabled.
OPTIMISTIC
Timeout after 5 minutes of execution
I have read that using OPTIMISTIC locking required additional overhead due to the copy of the cache entries.
However, I would like to know if the behaviour I got is normal or is there something I miss configured with the OPTIMISTIC locking.
Thanks to give me you comments on my tests and suggestion if configuration need to be changes.
An Phong Do
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4194861#4194861
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4194861
More information about the jboss-user
mailing list