[OPENDJ-2709] Reduce lock contention in SubentryManager and AuthenticatedUsers for modify/delete requests Created: 22/Feb/16  Updated: 08/Nov/19  Resolved: 15/Mar/16

Status: Done
Project: OpenDJ
Component/s: common-repo, core server
Affects Version/s: 2.6.2
Fix Version/s: 4.0.0, 3.5.0

Type: Improvement Priority: Major
Reporter: Matthew Swift Assignee: Matthew Swift
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Duplicate
is duplicated by OPENDJ-1678 authrate: Contention at Authenticated... Done
Relates
is related to OPENDJ-1692 Collection of potential performance i... Done
Dev Assignee: Matthew Swift

 Description   

While testing an in-memory backend prototype I observed significant contention in the SubentryManager. We have also seen this behavior less frequently against the JE / PDB backends:

"Worker Thread 17" prio=10 tid=0x00007f277ce6c800 nid=0x4c66 runnable [0x00007f276a7e6000]
   java.lang.Thread.State: WAITING (parking)
	at sun.misc.Unsafe.park(Native Method)
	- parking to wait for  <0x00000007420ab550> (a java.util.concurrent.locks.ReentrantReadWriteLock$NonfairSync)
	at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:834)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireShared(AbstractQueuedSynchronizer.java:964)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireShared(AbstractQueuedSynchronizer.java:1282)
	at java.util.concurrent.locks.ReentrantReadWriteLock$ReadLock.lock(ReentrantReadWriteLock.java:731)
	at org.opends.server.core.SubentryManager.getSubentries(SubentryManager.java:519)
	at org.opends.server.api.AuthenticationPolicy.forUser(AuthenticationPolicy.java:170)
	at org.opends.server.workflowelement.localbackend.LocalBackendAddOperation.handlePasswordPolicy(LocalBackendAddOperation.java:957)
	at org.opends.server.workflowelement.localbackend.LocalBackendAddOperation.processLocalAdd(LocalBackendAddOperation.java:452)
	at org.opends.server.workflowelement.localbackend.LocalBackendWorkflowElement.execute(LocalBackendWorkflowElement.java:550)
	at org.opends.server.core.WorkflowImpl.execute(WorkflowImpl.java:197)
	at org.opends.server.core.WorkflowTopologyNode.execute(WorkflowTopologyNode.java:100)
	at org.opends.server.core.AddOperationBasis.run(AddOperationBasis.java:764)
	at org.opends.server.extensions.TraditionalWorkerThread.run(TraditionalWorkerThread.java:167)

"Worker Thread 1" prio=10 tid=0x00007f277ce24000 nid=0x4c56 runnable [0x00007f276b7f6000]
   java.lang.Thread.State: RUNNABLE
	at sun.misc.Unsafe.unpark(Native Method)
	at java.util.concurrent.locks.LockSupport.unpark(LockSupport.java:152)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.unparkSuccessor(AbstractQueuedSynchronizer.java:662)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.doReleaseShared(AbstractQueuedSynchronizer.java:689)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.setHeadAndPropagate(AbstractQueuedSynchronizer.java:729)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireShared(AbstractQueuedSynchronizer.java:956)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireShared(AbstractQueuedSynchronizer.java:1282)
	at java.util.concurrent.locks.ReentrantReadWriteLock$ReadLock.lock(ReentrantReadWriteLock.java:731)
	at org.opends.server.core.SubentryManager.doPreOperation(SubentryManager.java:981)
	at org.opends.server.core.PluginConfigManager.invokePreOperationDeletePlugins(PluginConfigManager.java:2922)
	at org.opends.server.workflowelement.localbackend.LocalBackendDeleteOperation.processLocalDelete(LocalBackendDeleteOperation.java:279)
	at org.opends.server.workflowelement.localbackend.LocalBackendWorkflowElement.execute(LocalBackendWorkflowElement.java:556)
	at org.opends.server.core.WorkflowImpl.execute(WorkflowImpl.java:197)
	at org.opends.server.core.WorkflowTopologyNode.execute(WorkflowTopologyNode.java:100)
	at org.opends.server.core.DeleteOperationBasis.run(DeleteOperationBasis.java:417)
	at org.opends.server.extensions.TraditionalWorkerThread.run(TraditionalWorkerThread.java:167)


 Comments   
Comment by Matthew Swift [ 02/Mar/16 ]

After fixing this contention point we immediately hit a similar problem in AuthenticatedUsers.

This issue can be closed once both bottlenecks are fixed.

Comment by Matthew Swift [ 07/Nov/19 ]

Moved to closed state because the fixVersion has already been released.

Generated at Sat Oct 31 01:44:33 UTC 2020 using Jira 7.13.12#713012-sha1:6e07c38070d5191bbf7353952ed38f111754533a.