Rocketmq: while not use FileChannel.write()? rocketmq use mmap file write , may cause use a lot of share memory

Created on 4 Dec 2018  ·  4Comments  ·  Source: apache/rocketmq

here is a test for FileChannel.write() , and mmap file write
https://github.com/jkreps/valencia/blob/master/src/test/java/valencia/TestLinearWritePerformance.java
what,s more , MaxDirectMemorySize dont work for memory hold by mmap file .

question

Most helpful comment

@Ah39 Compared with FileChannel, MMAP can write to the page cache directly, but FileChannel with directbuffer needs to write to memory first, then write to the page cache. so MMAP has an advantage when writing a lot of small data into a file.

All 4 comments

MaxDirectMemorySize dont work for memory hold by mmap file .SHR memory is equals the mmap file size .

image
image

@Ah39 Compared with FileChannel, MMAP can write to the page cache directly, but FileChannel with directbuffer needs to write to memory first, then write to the page cache. so MMAP has an advantage when writing a lot of small data into a file.

@duhengforever but the rocketmq may hold 100G even more SHR memory .
how to control the memory use by rocketmq ,by mmap file ??

image

@duhengforever but the rocketmq may hold 100G even more SHR memory .
how to control the memory use by rocketmq ,by mmap file ??

image

Maybe using the dio in the future will be a good choice, memory management is entirely done by the application layer. However, This is a major change, and if you have any ideas, feel free to discuss them in the [email protected] mailing list.

Was this page helpful?
0 / 5 - 0 ratings