[
https://issues.apache.org/jira/browse/AMQ-9343?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17776749#comment-17776749
]
ASF subversion and git services commented on AMQ-9343:
------------------------------------------------------
Commit a26bf256d17135b5baaff0df64fc5cb51bad1cf8 in activemq's branch
refs/heads/activemq-5.18.x from Christopher L. Shannon (cshannon)
[ https://gitbox.apache.org/repos/asf?p=activemq.git;h=a26bf256d ]
AMQ-9343 - Reduce memory used for in flight transactions
This commit will reduce the memory required in KahaDB for long running
transactions and transactions with a lot of pending message sends by
clearing out the message memory when no longer needed instead of keeping
it tracked in the pending map
> 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)