You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2022/08/17 02:28:06 UTC

[GitHub] [rocketmq] maoyiyong-svg opened a new issue, #4829: RocketMq内存映射文件的具体实现MappedFile中关于方法commit0()中往channel中写数据的优化。

maoyiyong-svg opened a new issue, #4829:
URL: https://github.com/apache/rocketmq/issues/4829

   在org.apache.rocketmq.store.MappedFile#commit0中使用“this.fileChannel.write(byteBuffer);”导致没有利用文件内存映射机制,导致写入效率降低。
   原因:
   在MappedFile对象实例化的时候就会实例化fileChannel和MappedByteBuffer,完成之后在finally中可以直接关闭fileChannel,之后的数据读写应该使用MappedByteBuffer,通过文件内存映射来操作。
   ![image](https://user-images.githubusercontent.com/62745186/185017246-044241e1-5703-434b-a8e8-5946d66af6ae.png)
   此处建议使用mappedByteBuffer进行数据写入。
   ![image](https://user-images.githubusercontent.com/62745186/185020982-007dbe10-ad61-45e3-99e7-670b93aef5e4.png)
   


-- 
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: dev-unsubscribe@rocketmq.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] RongtongJin commented on issue #4829: Suggestion of commit0 method in MappedFile

Posted by GitBox <gi...@apache.org>.
RongtongJin commented on issue #4829:
URL: https://github.com/apache/rocketmq/issues/4829#issuecomment-1217520381

   @maoyiyong-svg 你好,MappedFile commit方法是在transientStorePoolEnable开启后使用的,其作用时将消息数据从RocketMQ自己管理的堆外内存写入到文件中(后面再由flush线程刷到磁盘),所以代码中出现了writeBuffer中的数据写到fileChannel中,实际上当开启transientStorePoolEnable后,写消息数据都是先写入到writeBuffer而非到内存映射的mappedByteBuffer(若不开启transientStorePoolEnable则是直接写到内存映射文件中)。


-- 
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: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] maoyiyong-svg closed issue #4829: Suggestion of commit0 method in MappedFile

Posted by GitBox <gi...@apache.org>.
maoyiyong-svg closed issue #4829: Suggestion of commit0 method in MappedFile
URL: https://github.com/apache/rocketmq/issues/4829


-- 
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: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org