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

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

                Author: ASF GitHub Bot
            Created on: 22/Sep/19 18:39
            Start Date: 22/Sep/19 18:39
    Worklog Time Spent: 10m 
      Work Description: franz1981 commented on issue #2844: ARTEMIS-1811 NIO 
Seq File should use RandomAccessFile with heap buffers
URL: https://github.com/apache/activemq-artemis/pull/2844#issuecomment-533906809
 
 
   I'm going to "tune" the optimization while reading/writing RandonAccessFile 
in chunks of 8192, because on 
https://github.com/netty/netty/pull/9591#issuecomment-533904873 I've measured 
that the allocator isn't a bottleneck when chunk size > 8192 and assuming 
single threaded usage (malloc -> free on the same thread). 
   ATM AMQP and OpenWire could cause big buffers allocation on native space (on 
JNI), so I would reduce the impact of this by tuning chunk size just to reduce 
the foot print over head of it.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

    Worklog Id:     (was: 316308)
    Time Spent: 2h 50m  (was: 2h 40m)

> NIOSequentialFile should use RandomAccessFile with heap ByteBuffers
> -------------------------------------------------------------------
>
>                 Key: ARTEMIS-1811
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-1811
>             Project: ActiveMQ Artemis
>          Issue Type: Improvement
>          Components: Broker
>    Affects Versions: 2.5.0
>            Reporter: Francesco Nigro
>            Assignee: Francesco Nigro
>            Priority: Major
>          Time Spent: 2h 50m
>  Remaining Estimate: 0h
>
> JournalStorageManager::addBytesToLargeMessage and 
> LargeServerMessageImpl::DecodingContext::encode are relying on the pooling of 
> direct ByteBuffers performed internally by NIO.
> Those buffers are pooled until certain size limit (ie 
> jdk.nio.maxCachedBufferSize, as shown on 
> [https://bugs.openjdk.java.net/browse/JDK-8147468]) otherwise are freed right 
> after the write succeed.
> If the property jdk.nio.maxCachedBufferSize isn't set, the direct buffers are 
> always pooled regardless of the size, leading to OOM issues on high load of 
> variable sized writes due to the amount of direct memory allocated and not 
> released/late released.
> The proposed solutions are:
>  # perform ad hoc direct ByteBuffer caching on the write path thanks to the 
> read lock
>  # replace the NIO SequentialFile usage and just use RandomAccessFile that 
> provide the right API to append byte[] without creating leaking native copies



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to