[
https://issues.apache.org/jira/browse/ARTEMIS-3449?focusedWorklogId=643882&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-643882
]
ASF GitHub Bot logged work on ARTEMIS-3449:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 31/Aug/21 06:37
Start Date: 31/Aug/21 06:37
Worklog Time Spent: 10m
Work Description: franz1981 edited a comment on pull request #3711:
URL: https://github.com/apache/activemq-artemis/pull/3711#issuecomment-908941654
In the current PR I see that I'm relying (write side) on the knowledge that
incoming data is using a composite readable buffer, while the whole complete
version should account of Netty/NIO ones too, to save the copy to happen,
looking more as
```java
public void addBytes(ReadableBuffer data) throws Exception {
parseLargeMessage(data);
boolean releaseBuffer = true;
ByteBuf writeBuffer = null;
try {
if (!data.hasArray()) {
// try access some direct buffer in
if (data instanceof ReadableBuffer.ByteBufferReader) {
final ByteBuffer nioBuffer = data.byteBuffer();
if (nioBuffer.isDirect()) {
writeBuffer = Unpooled.wrappedBuffer(nioBuffer);
releaseBuffer = false;
}
} else if (data instanceof NettyReadable) {
final ByteBuf nettyBuffer = ((NettyReadable)
data).getByteBuf();
if (nettyBuffer.isDirect()) {
writeBuffer = nettyBuffer;
releaseBuffer = false;
}
}
}
if (writeBuffer == null) {
// perform copy of data
final int bytes = data.remaining();
writeBuffer = PooledByteBufAllocator.DEFAULT.directBuffer(bytes,
bytes);
data.get(new NettyWritable(writeBuffer));
}
largeBody.addBytes(new ChannelBufferWrapper(writeBuffer, true,
true));
} finally {
if (releaseBuffer) {
if (writeBuffer != null) {
writeBuffer.release();
}
}
}
}
```
It seems very complicate to me, so I prefer to leave it as it is, @gemmellr
wdyt?
While I need your advice on the small change I've made on
https://github.com/apache/activemq-artemis/pull/3711/commits/7f56ab813f8eb1e5ceb7dba4d214ee6507d9f386:
is it safe?
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 643882)
Time Spent: 5h 20m (was: 5h 10m)
> Speedup AMQP large message streaming
> ------------------------------------
>
> Key: ARTEMIS-3449
> URL: https://issues.apache.org/jira/browse/ARTEMIS-3449
> Project: ActiveMQ Artemis
> Issue Type: Improvement
> Reporter: Francesco Nigro
> Assignee: Francesco Nigro
> Priority: Major
> Time Spent: 5h 20m
> Remaining Estimate: 0h
>
> AMQP is using unpooled heap ByteBuffer(s) to stream AMQP large messages:
> given that the underline NIO sequential file can both use FileChannel or
> RandomAccessFile (depending if the ByteBuffer used is direct/heap based),
> both approaches would benefit from using Netty pooled direct buffers and save
> additional copies (performed by RandomAccessFile) to happen, reducing GC too.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)