Stupid question
Greg Bowyer
gbowyer at fastmail.co.uk
Tue May 22 12:05:53 PDT 2012
Not sure if this is the right venue for this, or if I am insane
I have been playing with the openjdk code with a view to lock the heap
in memory (or at least suggest to the OS that it wants to be locked in
memory).
My use case is for java processes that are greedy in memory and
typically have a virtual size larger than physical ram. This is not
where an end user allocates a java heap beyond ram but rather things
like Lucene / Cassandra, where typically the JVM heap is large but
limited to say 1/4 of the total physical ram and the rest of the process
virtual size is taken up with mmap()'d files.
There are java projects that currently do this with a call out via JNA /
JNI to mlockall()
Asking the OS to use the MAP_LOCKED flag in the mmap calls in
os_linux.cpp effectively does an mlock / mlockall which I think means
that when the OS chooses pages to page out; then it should (for some
measure of should) avoid paging out the JVM heap.
This means that horrors between CMS and paging do not cause hateful
pauses (hopefully)
The thing I cant understand is that when I start a new VM with this code
(attached) it appears to lock the full size of the heap (-Xmx) (even
though the given memory is not used by the VM), this seems to make the
entire space resident.
any ideas ?
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: locked_heap.patch
Url: http://mail.openjdk.java.net/pipermail/hotspot-gc-use/attachments/20120522/bdb4aa8c/locked_heap.patch
More information about the hotspot-gc-use
mailing list