[
https://issues.apache.org/jira/browse/ARTEMIS-1151?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16000865#comment-16000865
]
ASF GitHub Bot commented on ARTEMIS-1151:
-----------------------------------------
Github user clebertsuconic commented on a diff in the pull request:
https://github.com/apache/activemq-artemis/pull/1256#discussion_r115269333
--- Diff:
artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/nio/NIOSequentialFile.java
---
@@ -293,14 +296,49 @@ private void internalWrite(final ByteBuffer bytes,
private void doInternalWrite(final ByteBuffer bytes,
final boolean sync,
final IOCallback callback) throws
IOException {
- channel.write(bytes);
+ try {
+ channel.write(bytes);
+
+ if (sync) {
+ sync();
+ }
- if (sync) {
- sync();
+ if (callback != null) {
+ callback.done();
+ }
+ } finally {
+ //release it to recycle the write buffer if big enough
+ this.factory.releaseBuffer(bytes);
}
+ }
- if (callback != null) {
- callback.done();
+ @Override
+ public void copyTo(SequentialFile dstFile) throws IOException {
+ ActiveMQJournalLogger.LOGGER.debug("Copying " + this + " as " +
dstFile);
--- End diff --
If you make a change here make it:
```
if (logger.isDebugEnabled()) {
logger.debug(.....);
}
```
> Adapting TimedBuffer and NIO Buffer Pooling
> -------------------------------------------
>
> Key: ARTEMIS-1151
> URL: https://issues.apache.org/jira/browse/ARTEMIS-1151
> Project: ActiveMQ Artemis
> Issue Type: Improvement
> Components: Broker
> Reporter: Francesco Nigro
> Assignee: Francesco Nigro
> Priority: Minor
>
> This is the list of improvements:
> - NIO/ASYNCIO new TimedBuffer with adapting batch window heuristic
> - NIO/ASYNCIO improved TimedBuffer write monitoring with lightweight
> concurrent performance counters
> - NIO/ASYNCIO journal/paging operations benefit from less buffer copy
> - NIO/ASYNCIO any buffer copy is always performed with raw batch copy using
> SIMD instrinsics (System::arrayCopy) or memcpy under the hood
> - NIO improved clear buffers using SIMD instrinsics (Arrays::fill) and/or
> memset
> - NIO journal operation perform by default TLABs allocation pooling (off
> heap) retaining only the last max sized buffer
> - NIO improved file copy operations using zero-copy FileChannel::transfertTo
> - NIO improved zeroing using pooled single OS page buffer to clean the file +
> pwrite (on Linux)
> - NIO deterministic release of unpooled direct buffers to avoid OOM errors
> due to slow GC
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)