Skip to content

Suggestion of commit0 method in MappedFile #4829

@maoyiyong-svg

Description

@maoyiyong-svg

在org.apache.rocketmq.store.MappedFile#commit0中使用“this.fileChannel.write(byteBuffer);”导致没有利用文件内存映射机制,导致写入效率降低。
原因:
在MappedFile对象实例化的时候就会实例化fileChannel和MappedByteBuffer,完成之后在finally中可以直接关闭fileChannel,之后的数据读写应该使用MappedByteBuffer,通过文件内存映射来操作。
image
此处建议使用mappedByteBuffer进行数据写入。
image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions