After changing the ulimit settings, you must restart the process to take advantage of the modified settings. You can use the /proc file system to see the current limitations on a running process. 

Depending on your system’s configuration, and default settings, any change to system limits made using ulimit may revert following system a system restart. Check your distribution and operating system documentation for more information. 

Note: SUSE Linux Enterprise Server 11 and potentially other versions of SLES and other SUSE distributions ship with virtual memory address space limited to 8GB by default. This must be adjusted in order to prevent virtual memory allocation failures as the database grows. 

The SLES packages for MongoDB adjust these limits in the default scripts, but you will need to make this change manually if you are using custom scripts and/or the tarball release rather than the SLES packages. 

## Recommended ulimit Settings 

Every deployment may have unique requirements and settings; however, the following thresholds and settings are particularly important for mongod and mongos deployments: 

• -f (file size): unlimited 

• -t (cpu time): unlimited 

• -v (virtual memory): unlimited 114 

• -n (open files): 64000 

• -m (memory size): unlimited 1 115 

• -u (processes/threads): 64000 

Always remember to restart your mongod and mongos instances after changing the ulimit settings to ensure that the changes take effect. 

## Linux distributions using Upstart 

For Linux distributions that use Upstart, you can specify limits within service scripts if you start mongod and/or mongos instances as Upstart services. You can do this by using limit stanzas$^{116}$. 

Specify the Recommended ulimit Settings (page 289), as in the following example: 

limit fsize unlimited unlimited # (file size) limit cpu unlimited unlimited # (cpu time) limit as unlimited unlimited # (virtual memory size) limit nofile 64000 64000 # (open files) limit nproc 64000 64000 # (processes/threads) 

Each limit stanza sets the “soft” limit to the first value specified and the “hard” limit to the second. 

After after changing limit stanzas, ensure that the changes take effect by restarting the application services, using the following form: 

restart <service name> 

