§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:


For small system

To set the vm.max_map_count = 262144,

¶Ubuntu distribution, for debina you use /sbin/sysctl

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


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

chatGPT

The suggested fs.file-max value of 98000 for MongoDB is a recommended setting that limits the number of open files allowed on the system. It is a best practice to set a specific limit to prevent potential resource exhaustion.

The default value of fs.file-max being set to 9223372036854775807 (which is the maximum value for a 64-bit system) means there is essentially no limit on the number of open files. While this may not cause an immediate issue for MongoDB, it could be problematic in certain situations or when other applications are running on the same system.

Setting fs.file-max to an appropriate value, like the suggested 98000 for MongoDB, is recommended to ensure that the system allocates resources in a controlled manner and to prevent potential issues with file descriptor exhaustion.

To set the fs.file-max value to 98000, you can follow these steps:

Open the /etc/sysctl.conf file using a text editor with root privileges (e.g., sudo nano /etc/sysctl.conf).

Add or modify the following line in the file:

fs.file-max = 98000

Save the file and exit the text editor.

Apply the changes using the sysctl command:

sudo sysctl -p

This will set the fs.file-max value to 98000 on your system, and it will take effect after a system reboot or when the sysctl -p command is executed. Be aware that changing system-wide configurations like this may require administrative privileges, so make sure you have the appropriate permissions before making these changes.