Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
PagingStoreImpl::ioSync is holding a readWriteLock while calling sync:
However that's causing a contention on adding new data:
at jdk.internal.misc.Unsafe.park(java.base@17.0.11/Native Method)
- parking to wait for <0x000000008087a170> (a java.util.concurrent.locks.ReentrantReadWriteLock$NonfairSync)
at java.util.concurrent.locks.LockSupport.park(java.base@17.0.11/LockSupport.java:211)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(java.base@17.0.11/AbstractQueuedSynchronizer.java:715)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(java.base@17.0.11/AbstractQueuedSynchronizer.java:938)
at java.util.concurrent.locks.ReentrantReadWriteLock$WriteLock.lock(java.base@17.0.11/ReentrantReadWriteLock.java:959)
at org.apache.activemq.artemis.core.paging.impl.PagingStoreImpl.writePage(PagingStoreImpl.java:1249)
at org.apache.activemq.artemis.core.paging.impl.PagingStoreImpl.page(PagingStoreImpl.java:1242)
at org.apache.activemq.artemis.core.paging.impl.PagingStoreImpl.page(PagingStoreImpl.java:1173)
at org.apache.activemq.artemis.core.persistence.impl.journal.AbstractJournalStorageManager.addToPage(AbstractJournalStorageManager.java:2256
To fix that I'm going to remove the sync from the readWriteLock. and Ignore an alreadyClosedException.
I tested this, and also an user and the improvement was significant, especially with a slower device (that's actually more common on cloud providers these days).