I am trying to find out how Infinispan is managing locking in a multi-owner scenario. We are getting loads of deadlock since we do a lot of writes per seconds to a given cache element. We can manage them with the deadlock detection but it does impact seriously the throughput even with low lock acquisition timeout values.
I was expecting a locking scheme were a single lock per element, no matter how much copies exists on the cluster, would be aquired leaving room for locking all other copies on the cluster without risking a deadlock. However what I observed is each node locking a copy and deadlocking when locking the other copies on the cluster.
Any explanation is welcome.
Are you using eager locking? If so you can enable eagerLockingSingleNode so that only one remote owner is locked. Local lock is always acquired, even if according to the concistent hash, the key does not map to the local node.