§2023-08-05
Configure sufficient file handles (fs.file-max), kernel pid limit (kernel.pid_max), maximum threads per process (kernel.threads-max), and maximum number of memory map areas per process (vm.max_map_count) for your deployment. For large systems, the following values provide a good starting point:
- fs.file-max value of 98000,
- kernel.pid_max value of 64000,
- kernel.threads-max value of 64000, and
- vm.max_map_count value of 128000
For small system
To set the vm.max_map_count = 262144,
¶Ubuntu distribution, for debina you use /sbin/sysctl
- sudo nano /etc/sysctl.conf
- Add the following line at the end of the file:
- vm.max_map_count=262144
- sudo sysctl -p
- The -p flag tells sysctl to reload the configuration from the specified file (/etc/sysctl.conf) and apply the changes.
- Verify that the changes have taken effect by running the following command:
- sysctl vm.max_map_count
- The output should show the updated value of vm.max_map_count.
If the output displays the new value you set in the /etc/sysctl.conf file, then the changes have been successfully applied. If you encounter any issues or errors, double-check your modifications in the configuration file and try again.
Remember that if you want the changes to persist across reboots, you should make sure that the value is correctly set in the /etc/sysctl.conf file as well.
¶ ArchLinux
- sudo nano /etc/sysctl.d/99-sysctl.conf
- Add the following line to the 99-sysctl.conf file:
- vm.max_map_count=128000
- sudo sysctl --system to make it permanent
- check with
sysctl vm.max_map_count
- Add the following line to the 99-sysctl.conf file:
other value are seemed to set well over required recommended by mongoDB Ubuntu or Archlinux
$ sysctl fs.file-max
fs.file-max = 9223372036854775807
$ sysctl kernel.pid_max
kernel.pid_max = 4194304
$ sysctl kernel.threads-max
kernel.threads-max = 124616