Return-Path: X-Original-To: apmail-cassandra-user-archive@www.apache.org Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BF8007D41 for ; Fri, 29 Jul 2011 01:13:34 +0000 (UTC) Received: (qmail 39637 invoked by uid 500); 29 Jul 2011 01:13:32 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 39498 invoked by uid 500); 29 Jul 2011 01:13:31 -0000 Mailing-List: contact user-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cassandra.apache.org Delivered-To: mailing list user@cassandra.apache.org Received: (qmail 39490 invoked by uid 99); 29 Jul 2011 01:13:31 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 29 Jul 2011 01:13:31 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of tholzer@wetafx.co.nz designates 110.232.144.26 as permitted sender) Received: from [110.232.144.26] (HELO meera.wetafx.co.nz) (110.232.144.26) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 29 Jul 2011 01:13:26 +0000 Received: from localhost (localhost [127.0.0.1]) by meera.wetafx.co.nz (Postfix) with ESMTP id 22ECA9EF0018; Fri, 29 Jul 2011 13:13:04 +1200 (NZST) X-Virus-Scanned: with amavisd-new by meera at meera.wetafx.co.nz Received: from meera.wetafx.co.nz ([127.0.0.1]) by localhost (meera.wetafx.co.nz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id crvkHssjl3R9; Fri, 29 Jul 2011 13:13:03 +1200 (NZST) Received: from jupiter036.localdomain (webmail.wetafx.co.nz [192.168.120.66]) by meera.wetafx.co.nz (Postfix) with ESMTP id 3A3769EF0003; Fri, 29 Jul 2011 13:13:03 +1200 (NZST) Received: from localhost (localhost [127.0.0.1]) by jupiter036.localdomain (Postfix) with ESMTP id 2A7735BE9A7; Fri, 29 Jul 2011 13:13:03 +1200 (NZST) X-Virus-Scanned: amavisd-new at wetafx.co.nz Received: from jupiter036.localdomain ([127.0.0.1]) by localhost (smtp-digi.wetafx.co.nz [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 7DwpkmqAYkOM; Fri, 29 Jul 2011 13:13:03 +1200 (NZST) Received: from [192.168.49.114] (boarshead.wetafx.co.nz [192.168.49.114]) by jupiter036.localdomain (Postfix) with ESMTP id 0D05F5BE961; Fri, 29 Jul 2011 13:13:03 +1200 (NZST) Message-ID: <4E32091E.2060308@wetafx.co.nz> Date: Fri, 29 Jul 2011 13:13:02 +1200 From: Teijo Holzer User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20110705 Thunderbird/5.0 MIME-Version: 1.0 To: user@cassandra.apache.org CC: Stephen Henderson Subject: Re: memory_locking_policy parameter in cassandra.yaml for disabling swap - has this variable been renamed? References: In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit Hi, yes I was looking for this config as well. This is really simple to achieve: Put the following line into /etc/security/limits.conf cassandra - memlock 32 Then, start Cassandra as the user cassandra, not as root (note there is never a need to run Cassandra as root, all functionality can be achieved from a normal user by changing the right configs). In the log you will see: [2011-07-29 13:06:46,491] WARN: Unable to lock JVM memory (ENOMEM). This can result in part of the JVM being swapped out, especially with mmapped I/O enabled. Increase RLIMIT_MEMLOCK or run Cassandra as root. (main CLibrary.java:118) Done. If you want enable mlockall again, simply change the above 32(k) value to the size of your RAM (e.g. 17825792 for a 16GB machine). We also have turned off mmap altogether and never had any memory issues again. swap is happily enabled. We currently prefer stability over performance. Cheers, T. On 28/07/11 22:17, Stephen Henderson wrote: > Hi, > > 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 > > --- > > Thanks, > > Stephen > > *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 >