zoukankan      html  css  js  c++  java
  • ES mlockall作用——preventing that memory from being paged to the swap area

    elasticsearch还有一个重要的参数bootstrap.mlockall,这个参数的目的是当你无法关闭系统的swap的时候,建议把这个参数设为true。防止在内存不够用的时候,elasticsearch的内存被交换至交换区,导致性能骤降

    mlock, munlock, mlockall, munlockall - lock and unlock memory

    Synopsis

    #include <sys/mman.h>
    
    int mlock(const void *addr, size_t len);
    int munlock(const void *addr, size_t len);
    
    int mlockall(int flags);
    int munlockall(void);
    

    Description

    mlock() and mlockall() respectively lock part or all of the calling process's virtual address space into RAM, preventing that memory from being paged to the swap areamunlock() andmunlockall() perform the converse operation, respectively unlocking part or all of the calling process's virtual address space, so that pages in the specified virtual address range may once more to be swapped out if required by the kernel memory manager. Memory locking and unlocking are performed in units of whole pages.

    mlock系统调用的作用mlock系统调用允许程序在物理内存上锁住它的部分或全部地址空间,这将阻止Linux将这个内存页调度到交换空间(即阻止系统将某个页面换出到交换分区),即使该程序已有一段时间没有访问这段空间。一个严格时间相关的程序可能会希望锁住物理内存,因为内存页面调出调入的时间延迟可能太长或过于不可预知。安全性要求较高的应用程序可能希望防止敏感数据被换出到交换文件中,因为这样在程序结束后,攻击者可能从交换文件中恢复出这些数据。锁定一个内存区间只需简单将指向区间开始的指针及区间长度作为参数调用mlock()Linux分配内存到页且每次只能锁定整页内存,被指定的区间涉及到的每个内存页都将被锁定。

    参考:https://linux.die.net/man/2/mlockall

  • 相关阅读:
    MySQL错误 1030-Got error 28 from storage engine
    电脑开机无反应 不显示BIOS 硬件没问题
    python错误 import: unable to open X server
    Python 错误 invalid command 'bdist_wheel' & outside environment /usr
    Cento 7安装 Failed to execute /init
    笔记《鸟哥的Linux私房菜》5 首次登入与在线求助 man
    Scrapy XPath语法
    Linux 用户操作
    Mysql 表修改
    Ubuntu 配置 Python环境 IPython
  • 原文地址:https://www.cnblogs.com/bonelee/p/6207097.html
Copyright © 2011-2022 走看看