On Jul 15, 2010, at 2:52 PM, Jonathan Ellis wrote:

> On Thu, Jul 15, 2010 at 3:56 PM, Carlos Alvarez <cbalva...@gmail.com> wrote:
>> On Thu, Jul 15, 2010 at 2:01 PM, Jonathan Ellis <jbel...@gmail.com> wrote:
>>> The main problem is not the syscall so much as Java insisting on
>>> zeroing out any buffer you create, which is a big hit to performance
>>> when you're allocating buffers for file i/o on each request instead of
>>> just mmaping things.  Re-using those buffers would be possible but
>>> difficult; I think using mlockall to "fix" the mmap approach is more
>>> promising.
>> 
>> Sorry if it is a silly question, but what would be the approach? issue
>> a mlockall with the current set (MLC_CURRENT) before mmap the files?
> 
> right
> 

This would require that Cassandra run as root on Linux systems, as 'man 
mlockall' states:

"Only root processes are allowed to lock pages"

FreeBSD is less clear about it and just say that a process needs "the right 
privileges".

One other approach that works on Linux is to use HugeTLB. This post details the 
process for doing so with a jvm:

http://andrigoss.blogspot.com/2008/02/jvm-performance-tuning.html

Basically when mmapping using HUGETLB you don't have to be root, but your 
memory ends up being effectively locked, so that would prevent the swapping, 
and might have the added bonus of slightly faster memory allocation/access.

Reply via email to