[ 
https://issues.apache.org/jira/browse/ARTEMIS-5305?focusedWorklogId=957614&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-957614
 ]

ASF GitHub Bot logged work on ARTEMIS-5305:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 18/Feb/25 18:56
            Start Date: 18/Feb/25 18:56
    Worklog Time Spent: 10m 
      Work Description: clebertsuconic commented on code in PR #5498:
URL: https://github.com/apache/activemq-artemis/pull/5498#discussion_r1960360170


##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java:
##########
@@ -1262,8 +1324,16 @@ private boolean writePage(Message message,
                              Transaction tx,
                              RouteContextList listCtx,
                              Function<Message, Message> pageDecorator) throws 
Exception {
-      lock.writeLock().lock();
-
+      if (timedWriter == null) {
+         // in case timedWriter is not being used, we need to guarantee a 
writeLock.
+         // because there's no way to upgrade from reading to writeLock
+         writeLock();
+      } else {
+         // if we are using a timedWritter, we can just use a readLock to 
guarantee paging is not changed
+         // this will issue the writer on a different thread, and we can just 
use a readLock
+         readLock();

Review Comment:
   thing is... when the pagedTimeWriter is in use, things are pretty much 
single threaded.. and updated from the PageExecutor. The only difference is to 
schedule a task it needs to use a readLock to make sure it was paging, and it 
should stay paging until the task is scheduled.





Issue Time Tracking
-------------------

    Worklog Id:     (was: 957614)
    Time Spent: 2.5h  (was: 2h 20m)

> Improve performance on paging for multiple producers and optimize locking
> -------------------------------------------------------------------------
>
>                 Key: ARTEMIS-5305
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-5305
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>    Affects Versions: 2.39.0
>            Reporter: Clebert Suconic
>            Assignee: Clebert Suconic
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 2.40.0
>
>          Time Spent: 2.5h
>  Remaining Estimate: 0h
>




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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact


Reply via email to