Cassandra2.0 JNA配置
Cassandra中通过JNA可以调用Native方法优化Jvm内存,大概意思就是不让操作系统将jvm内存置换到系统swap分区,从而提升jvm内存性能。它有两个用处:
-
Since 0.6.2: JNA for mlockall. This prevents Linux from swapping out parts of the JVM that aren't accessed frequently. Chris Goffinet reported a 13% performance improvement in his tests from this change. CASSANDRA-1214
-
Since 0.6.6: JNA for hard links, improving snapshots. Previously Cassandra would use the
/bin/ln
binary to create hard links to SSTables when creating a snapshot. On nodes with thousands of SSTables, this would take a very long time, because it had to fork+exec the JVM to run the new process. With JNA, Cassandra uses the link call directly. CASSANDRA-1371
P.S. JNA配置不是必须的,但官方建议生成环境下使用JNA。
我的软件环境:CentOS6 64bit + Cassandra2.0(DataStax社区版,通过YUM安装的)
开启方法如下:
1. 下载并放置JNA
cp jna-4.0.0.jar /usr/share/cassandra/lib/jna-4.0.0.jar
2. 开启JNA
cassandra soft memlock unlimited
cassandra hard memlock unlimited
注意: 通过yum安装的dsc是通过cassandra用户启动的,所以我配置上面为cassandra用户。
3. 验证安装
如果没有配置JNA,cassandra log将会打印如下信息:
配置成功后,会出现如下log:
4. 错误诊断
将JNA jar包放置后,但如果没有配置好系统limit的话,将会出现如下log:
完成步骤2配置,就可以解决这个警告。
参考:
https://journal.paul.querna.org/articles/2010/11/11/enabling-jna-in-cassandra/
--end
已有 0 人发表留言,猛击->> 这里<<-参与讨论
ITeye推荐