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

Alan Protasio commented on AMQ-7143:
------------------------------------

Hi [~cshannon]

 

I will update the tests... On my local SSD i cannot se huge improvement but 
when i run in a shared volume (NFS with higher latency) this makes a huge 
difference. See the results for a 10MB transaction.

Before:

Running org.apache.activemq.store.kahadb.disk.page.TransactionTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 28.774 sec - in 
org.apache.activemq.store.kahadb.disk.page.TransactionTest

 

After:


Running org.apache.activemq.store.kahadb.disk.page.TransactionTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 5.834 sec - in 
org.apache.activemq.store.kahadb.disk.page.TransactionTest

> Temporary transaction file (PageFile) being opened and closed many times, 
> leading poor performance
> --------------------------------------------------------------------------------------------------
>
>                 Key: AMQ-7143
>                 URL: https://issues.apache.org/jira/browse/AMQ-7143
>             Project: ActiveMQ
>          Issue Type: Improvement
>          Components: KahaDB
>    Affects Versions: 5.15.8
>            Reporter: Alan Protasio
>            Assignee: Christopher L. Shannon
>            Priority: Major
>
> Hi,
> This is an optimization when we have a transaction with many writes (bigger 
> than 10mb by default) and activemq creates a temporary transaction file 
> (pageFile transaction).
> The problem is when this transaction is committed, this temporary file is 
> opened and closed many times (number of writes inside the transaction), 
> causing poor performance (this is operation "freezes the world" during the 
> checkpoint).
>  
> See:
> [https://github.com/apache/activemq/blob/master/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/page/PageFile.java#L1147]
> [https://github.com/apache/activemq/blob/master/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/page/PageFile.java#L203]
>  
> Note that is the recoveryFile is enabled, we open and close the temporary 3 
> times for each index write.
> There is also a small bug that if the transaction is rolledBack, the 
> temporary file is left there forever, see:
> [https://github.com/apache/activemq/blob/master/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/page/Transaction.java#L686]
> [https://github.com/apache/activemq/blob/master/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/page/PageFile.java#L1200]
>  
> As the transaction is rolledback, no writes will be performed and so, the 
> file will never be deleted.
> The proposed change, use the same "RandomAccessFile" object used in the 
> transaction and close if when all writes is done (so we stop opening and 
> closing it for each write, and only do it one time per transaction).
>  
> Thanks



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to