hbase mlockall,
mlockall
头文件:#include <sys/mman.h>函数原型:int mlockall(int flags);
flags:
MCL_CURRENT ——Lock all pages which are currently mapped into the address space of the process. MCL_FUTURE ——— Lock all pages which will become mapped into the address space of the process in the future. These could be for instance new pages required by a growing heap and stack as well as new memory mapped files or shared memory regions.返回值: 成功:返回0; 错误:返回-1,errno被设置。
该函数的功能: 将进程使用的部分或者全部的地址空间锁定在物理内存中,防止其被交换到swap空间。 有些对时间敏感的应用会希望全部使用物理内存,以提高数据访问和操作的效率。
HBase中使用该功能:
mlockall_agent VM是一个简单的代理,允许锁的地址空间的过程。这避免了在压力下进程的内存回收。
一个例子是当regionserver的服务器运行在同一台机器上和一些使用mapreduce任务中,一些未使用的数据在该地区的服务器可能会交换,这影响服务器性能。
在hbase-env.sh中添加:(并且JVM必须是在root用户下运行)
export HBASE_REGIONSERVER_OPTS="-agentpath:./libmlockall_agent.so=user=hbase"
本站文章为和通数据库网友分享或者投稿,欢迎任何形式的转载,但请务必注明出处.
同时文章内容如有侵犯了您的权益,请联系QQ:970679559,我们会在尽快处理。