-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Hibernate + Infinispan - EAP6.1 - locks in 2LC cache
PostPosted: Tue Dec 10, 2013 4:13 pm 
Newbie

Joined: Tue Dec 10, 2013 11:10 am
Posts: 1
Hello,

I am using Infinispan as second level Hibernate cache in EAP 6.1. I'm working on single node.

It seems that the cache is set up and being used properly. I have noticed that in case of heavy load there occured some lock timeouts on keys of cached entities.

And really, if I switched the infinispan log to TRACE, I've found that the lock is being acquired:

Code:

    15:30:51,330 TRACE [org.infinispan.util.concurrent.locks.LockManagerImpl] (Thread-12 (HornetQ-client-global-threads-972879781)) Attempting to lock com.productcatalog.ParameterMappingE 
    lement#-3 with acquisition timeout of 10000 millis 
    15:30:51,330 TRACE [org.infinispan.util.concurrent.locks.containers.ReentrantPerEntryLockContainer] (Thread-12 (HornetQ-client-global-threads-972879781)) Creating and acquiring new lock instance fo 
    r key com.productcatalog.ParameterMappingElement#-3 
    15:30:51,330 TRACE [org.infinispan.util.concurrent.locks.LockManagerImpl] (Thread-12 (HornetQ-client-global-threads-972879781)) Successfully acquired lock com.productcatalog.Parameter 
    MappingElement#-3! 
    15:30:51,330 TRACE [org.infinispan.util.concurrent.locks.LockManagerImpl] (Thread-12 (HornetQ-client-global-threads-972879781)) Attempting to unlock com.productcatalog.ParameterMappin 
    gElement#-3 
    15:30:51,331 TRACE [org.infinispan.util.concurrent.locks.containers.ReentrantPerEntryLockContainer] (Thread-12 (HornetQ-client-global-threads-972879781)) Unlocking lock instance for key com.productcatalog.ParameterMappingElement#-3 



The application never changes cached data so I've configured the ConcurrencyStrategy to @Cache(usage=CacheConcurrencyStrategy.READ_ONLY).

It is strange for me that there are some locks, I thought that in case the it is used in READ_ONLY mode then nothing must be locked as there is no risk that concurrent threads will affect the cache values.

my persistence.xml looks like this:

Code:
    <shared-cache-mode>ENABLE_SELECTIVE</shared-cache-mode> 
            <properties> 
                <property name="hibernate.hbm2ddl.auto" value="validate" /> 
                <!-- <property name="hibernate.show_sql" value="true" /> --> 
                <!--  <property name="hibernate.format_sql" value="true" />  --> 
                <!--<property name="hibernate.transaction.flush_before_completion" value="true" /> --> 
                <property name="hibernate.cache.region.factory_class" value="org.jboss.as.jpa.hibernate4.infinispan.InfinispanRegionFactory"/> 
                <property name="hibernate.cache.infinispan.cachemanager" value="java:jboss/infinispan/container/hibernate"/> 
                <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/> 
                <property name="hibernate.cache.use_second_level_cache" value="true"/> 
                <property name="hibernate.cache.use_query_cache" value="true" /> 
            </properties> 


and the excerpt from standalone.xml is as follows:

Code:
     <cache-container name="hibernate" default-cache="local-query" module="org.jboss.as.jpa.hibernate:4"> 
                    <local-cache name="entity"> 
                        <locking isolation="READ_COMMITTED" striping="false" concurrency-level="2000"/> 
                        <transaction mode="NON_XA"/> 
                        <eviction strategy="LRU" max-entries="10000"/> 
                        <expiration max-idle="100000" lifespan="600000"/> 
                    </local-cache> 
                    <local-cache name="local-query"> 
                        <locking  isolation="READ_COMMITTED" striping="false" concurrency-level="2000"/> 
                        <transaction mode="NONE"/> 
                        <eviction strategy="LRU" max-entries="10000"/> 
                        <expiration max-idle="100000" lifespan="600000"/> 
                    </local-cache> 
                    <local-cache name="timestamps"> 
                        <locking  isolation="READ_COMMITTED" striping="false" concurrency-level="2000"/> 
                        <transaction mode="NONE"/> 
                        <eviction strategy="NONE"/> 
                        <expiration lifespan="600000"/> 
                    </local-cache> 
                </cache-container> 

Could anybody tell me why entities are locked when cache is in READ_ONLY mode?

Many thanks.

Martin


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.