linux系統配置 linux引數之max_map_count
使用命令:
sysctl
sysctl vm.max_map_count 檢視
sysctl -w vm.max_map_count=262144 臨時操作,肯能重啟後失效
To set this value permanently, update the vm.max_map_count
setting in /etc/sysctl.conf
. To verify after rebooting 永久操作
手冊地址:
http://www.jinbuguo.com/man/sysctl.html
sysctl命令用於執行時配置核心引數,這些引數位於/proc/sys目錄下
比如:/proc/sys/vm/max_map_count
linux引數之max_map_count,這個引數es under docker 有時候就會遇到
“This file contains the maximum number of memory map areas a process may have. Memory map areas are used as a side-effect of calling malloc, directly by mmap and mprotect, and also when loading shared libraries.
While most applications need less than a thousand maps, certain programs, particularly malloc debuggers, may consume lots of them, e.g., up to one or two maps per allocation.
The default value is 65536.”
max_map_count檔案包含限制一個程序可以擁有的VMA(虛擬記憶體區域)的數量。虛擬記憶體區域是一個連續的虛擬地址空間區域。在程序的生命週期中,每當程式嘗試在記憶體中對映檔案,連結到共享記憶體段,或者分配堆空間的時候,這些區域將被建立。調優這個值將限制程序可擁有VMA的數量。限制一個程序擁有VMA的總數可能導致應用程式出錯,因為當程序達到了VMA上線但又只能釋放少量的記憶體給其他的核心程序使用時,作業系統會丟擲記憶體不足的錯誤。如果你的作業系統在NORMAL區域僅佔用少量的記憶體,那麼調低這個值可以幫助釋放記憶體給核心用。
sysctl vm.max_map_count 檢視
永久設定:
To set this value permanently, update the vm.max_map_count
setting in /etc/sysctl.conf
重啟後驗證
sysctl vm.max_map_count