cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Schuller <peter.schul...@infidyne.com>
Subject Re: memory consuption
Date Fri, 18 Feb 2011 08:25:28 GMT
> main argument for using mmap() instead of standard I/O is the fact
> that reading entails just touching memory - in the case of the memory
> being resident, you just read it - you don't even take a page fault
> (so no overhead in entering the kernel and doing a semi-context
> switch).

Oh and in the case of Java/Cassandra, as Jonathan clued me in on
earlier, there is also the issue that byte[] arrays are mandated to be
zeroed when allocated which causes overhead typically because there
has to be a loop[1] somewhere writing a bunch of zeroes in, that
you're then just going to replace immediately. Mapping a file has no
such implications as long as you read directly from the underlying
direct ByteBuffer.

[1] Not *necessarily*; a JVM could theoretically do byte[] allocations
in such a way that it already knows the contents is zeroed, but it
would be highly dependent on the GC/memory management technique used
by the JVM whether this is practical. (It just occurred to me that
Azul should get this for 'free' in their GC. Wonder if that's true.)

-- 
/ Peter Schuller

Mime
View raw message