Github user franz1981 commented on the issue: https://github.com/apache/activemq-artemis/pull/1361 @clebertsuconic There is no need to use a ThreadLocal or a pooled buffer there because: 1) the method (write/read) is synchronized and it is safe to reuse the same ByteBuf wrapper between different threads (note: is only a wrapper on the ByteBuffer provided by the file factory) 2) the file factory already provides a (thread local) pooled direct ByteBuffer (on NIO) In the old version the most of the garbage was already avoided due to the fileFactory ByteBuffer thread local pooling, but I've measured after multiple Page writes lots of minor GCs due to many short living ActiveMQBuffer instances. This change aims reduce that instances to be only 1 per Page: it is not optimal but is a big improvement. With 100 bytes messages and a Page of 10 MB it avoids about 104856 instances of garbage.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---