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/
2. 开启JNA
vi /etc/security/limits.d/cassandra.conf
cassandra soft memlock unlimited
cassandra hard memlock unlimited
注意: 通过yum安装的dsc是通过cassandra用户启动的,所以我配置上面为cassandra用户。
3. 验证安装
如果没有配置JNA,cassandra log将会打印如下信息:
INFO 12:17:58,616 JNA not found. Native methods will be disabled.
配置成功后,会出现如下log:
INFO 09:59:59,184 JNA mlockall successful
4. 错误诊断
将JNA jar包放置后,但如果没有配置好系统limit的话,将会出现如下log:
WARN 10:49:53,587 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.
完成步骤2配置,就可以解决这个警告。
服务器托管,北京服务器托管,服务器租用 http://www.fwqtg.net
机房租用,北京机房租用,IDC机房托管, http://www.fwqtg.net
相关推荐: C国演义 [第六章]
最长递增子序列
最长连续递增序列第六章 最长递增子序列 题目理解 步骤 dp含义 递推公式 初始化 遍历顺序 代码 最长连续递增序列 题目理解 步骤 dp含义 递推公式 初始化 遍历顺序 代码 最长递增子序列 力扣链接 给你一个整数数组 nums ,找到其中最长严格递增子序列的长度。 子序列…