Disable swap

Using swap space with Cassandra is bad for performance. Remember that swap space is essentially disk space used to extend RAM. The big difference is that reading references from RAM can be done in 100 nanoseconds, while disk seeks alone take about 20 milliseconds (Bonér, 2012). The bottom line is that it's better to have less memory than to have lots of slow memory.

Disabling swap is fairly simple, and can be done with this command:

sudo swapoff --all

Persisting this change after a reboot is done by editing /etc/fstab and removing the swap entries.

Get Mastering Apache Cassandra 3.x - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.