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

ASF subversion and git services commented on AMQ-9343:
------------------------------------------------------

Commit 961067ec19c71149ef1467966556110683cdc47c in activemq's branch 
refs/heads/main from Christopher L. Shannon
[ https://gitbox.apache.org/repos/asf?p=activemq.git;h=961067ec1 ]

Merge pull request #1075 from cshannon/AMQ-9343

AMQ-9343 - Reduce memory used for in flight transactions

> Reduce inflight transaction memory footprint in KahaDB
> ------------------------------------------------------
>
>                 Key: AMQ-9343
>                 URL: https://issues.apache.org/jira/browse/AMQ-9343
>             Project: ActiveMQ
>          Issue Type: Improvement
>          Components: KahaDB
>            Reporter: Christopher L. Shannon
>            Assignee: Christopher L. Shannon
>            Priority: Major
>             Fix For: 6.0.0, 5.18.3, 5.17.6
>
>          Time Spent: 1h
>  Remaining Estimate: 0h
>
> When transacted messages are sent KahaDB tracks the inflight and prepared 
> (for XA) add commands in a map so that when the transaction is eventually 
> committed the commands can be used to update the KahaDB index. Currently the 
> entire message is kept inside the map while the transaction is pending. This 
> is not a problem for small/quick transactions but for transactions that are 
> long running and/or have a lot of pending (or big) messages before commit 
> this can use up a decent amount of memory and cause GC pressure.
> To reduce memory we can go ahead and just clear the message from the command 
> after it is stored in the journal. The pending operations that are queued up 
> to be processed on commit only need metadata from the add command (such as 
> message id and destination) so the actual messages are no longer needed and 
> can be cleared. This is a pretty easy change and should help for edge cases 
> with a large number of pending message sends or big messages.
> Note that on broker restart/recovery the messages are loaded again for 
> pending transactions and processed (such as XA in the prepared state) and the 
> messages are needed for processing recovery for XA transactions so the memory 
> will be higher again as the inflight and prepared maps will track the entire 
> message again (just like before this change) but this should be fine as it is 
> just during recovery and once finished and the broker is online again it will 
> clear the new incoming messages.



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

Reply via email to