[ 
https://issues.apache.org/jira/browse/ARTEMIS-4773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17847311#comment-17847311
 ] 

ASF subversion and git services commented on ARTEMIS-4773:
----------------------------------------------------------

Commit 22540cc3ab5802e1b3019f55791a20e5adca8983 in activemq-artemis's branch 
refs/heads/main from Clebert Suconic
[ https://gitbox.apache.org/repos/asf?p=activemq-artemis.git;h=22540cc3ab ]

ARTEMIS-4773 Performance improvement on page.sync

the sync should be called outside of the lock.
if the file was already closed it should then just be ignored as the data was 
locked anyway.


> Performance improvement on page.sync
> ------------------------------------
>
>                 Key: ARTEMIS-4773
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-4773
>             Project: ActiveMQ Artemis
>          Issue Type: Improvement
>            Reporter: Clebert Suconic
>            Priority: Major
>
> PagingStoreImpl::ioSync is holding a readWriteLock while calling sync:
> https://github.com/apache/activemq-artemis/blob/c523458a9aa4f67ad0e9bdbc5c4733bc88bf55f6/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java#L516-L529
> 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).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to