We’ve started having problems with cassandra and memory swapping on linux which seems to be a fairly common issue (in our particular case after about a week all swap space will have been used up and we have to restart the process).


It sounds like the general consensus is to just disable swap completely, but the recently released “Cassandra High Performance Cookbook” from Packt has instructions for “Stopping cassandra from using swap without disabling it system wide”. We’ve tried following the instructions but it refers to a “memory_locking_policy” variable in cassandra.yaml which throws an “unknown property” error on startup and I can’t find any reference to it in any of the cassandra docs.


I’ve copied the summarised instructions below, does anyone know if this is something that ever worked or is there a different variable to set which does the same thing? (we’re using 0.7.4 at present and it looks like the book was written for 0.7.0-beta-1.10 so it might have been something which was abandoned during beta?)


Disabling Swap Memory system-wide may not always be desirable. For example, if the system is not dedicated to running Cassandra, other processes on the system may benefit from Swap Memory. This recipe shows how to install the Java Native Architecture, which allows Java to lock itself in memory making it inevitable.


1. Place the jna.jar and platform.jar in the $CASSANDRA_HOME/lib directory:

2. Enable memory_locking_policy in $CASSANDRA_HOME/conf/cassandra.yaml:   “memory_locking_policy: required”

3. Restart your Cassandra instance.

4. Confirm this configuration has taken effect by checking to see if a large portion of memory is Unevictable:

$ grep Unevictable /proc/meminfo

Unevictable:        1024 Kb







Stephen Henderson – Lead Developer (Onsite), Cognitive Match

stephen.henderson@cognitivematch.com | http://www.cognitivematch.com

T: +44 (0) 203 205 0004 | F: +44 (0) 207 526 2226