NIO memory mapped files and Linux Virtual Memory performance issues

Alan Bateman Alan.Bateman at oracle.com
Tue Aug 20 00:21:09 PDT 2013


On 19/08/2013 21:04, Apurva Mehta wrote:
> Hello,
>
> We are using NIO FileChannels to memory map files in a JVM 1.6 
> environment on a RHEL6 system with a Linux-2.6.32.x kernel.
>
> The Linux Virtual Memory system is performing pretty poorly for us. In 
> particular, 'sar -B' on these machines reports elevated pgscand/s 
> counts (in the millions of page scans per second) which correlate with 
> severely degraded service latencies. Sar also reports virtual memory 
> efficiency close to 0% most of the time.
>
> Our systems have 48GB of physical memory. At peak, we have 2000 files 
> each of size 10 MB (ie 20 GB total)  which are memory mapped via NIO 
> File channels. We typically churn through 900x10MB (9GB) memory mapped 
> files per day per host (ie. we map / flush / unmap 900 files per 
> day).  Our Java heap size is 5GB.
>
> I was wondering if anybody has seen similar issues using NIO file 
> channels to memory map files to effectively have a large amount of 
> off-heap memory?  Intuitively, Linux should not have a problem with 
> this kind of memory usage, so we are investigating any potential 
> issues with the NIO / JVM / Linux interaction, and if there is 
> something we can tune.
>
> Any thoughts would be most welcome!
>
It's hard to say. Are you sure that there are at most a total of 20GB of 
mappings? Do you know if MappedByteBuffer.load is used frequently?

One thing to mention is that there is instrumentation in JDK 7 to 
monitor mapped byte buffers with any JMX monitoring tool. That may be 
useful once you get to upgrade.

-Alan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/nio-discuss/attachments/20130820/b9331634/attachment.html 


More information about the nio-discuss mailing list