diff --git a/draft/administration/ulimit.txt b/draft/administration/ulimit.txt index 346d4ea37c8..a429f8414ce 100644 --- a/draft/administration/ulimit.txt +++ b/draft/administration/ulimit.txt @@ -3,7 +3,7 @@ Linux ``ulimit`` Settings ========================= The Linux kernel provides a system to limit and control the number of -threads, connections, open files, on a per-process and per-user +threads, connections, and open files on a per-process and per-user basis. These limits prevent renegade processes from using too many system resources. Sometimes, these limits, as configured by the distribution developers, are too low for MongoDB and can cause a @@ -13,18 +13,20 @@ Resource Utilization -------------------- :program:`mongod` and :program:`mongos` each use threads and file -descriptors to track connections, and manage internal operations. This -section outlines the general resource utilization patterns for -MongoDB. Use these figures in combination with the actual +descriptors to track connections and manage internal operations. This +section outlines the general resource utilization patterns for MongoDB. +Use these figures in combination with the actual information about your +deployment and its use to determine ideal ``ulimit`` settings. ``mongod`` ~~~~~~~~~~ -- 1 thread for each incoming connection from clients and, for - :term:`replica sets `, other :program:`mongod` instances. +- 1 thread for each incoming connection from a client and for + each incoming connection from a :program:`mongod` instance in a + :term:`replica set `. -- 1 thread for each outgoing connection to another :program:`mongod` - when running in a replica set. +- 1 thread for each outgoing connection to a :program:`mongod` + in a replica set. - 1 file descriptor for each incoming connection. @@ -32,16 +34,16 @@ MongoDB. Use these figures in combination with the actual :program:`mongod` instance. - 1 file descriptor for each journal file used by the - :program:`mongod` instance (when :setting:`journal` is ``true``.) + :program:`mongod` instance when :setting:`journal` is ``true``. -:program:`mongod` uses threads for a number of internal processes -including :ref:`TTL collections ` and replication +:program:`mongod` uses threads for a number of internal processes, +including :ref:`TTL collections ` and replication, which may require a small number of additional resources. ``mongos`` ~~~~~~~~~~ -- 1 thread for each incoming connection from clients. +- 1 thread for each incoming connection from a client. - 1 file descriptor for each incoming connection. @@ -55,18 +57,20 @@ For :program:`mongos`, consider the following behaviors: fulfill requests without needing to create new connections. - The size of the connection pool is configurable with the - :setting:`maxConns` runtime options (i.e. :option:`--maxConns - `.) + :setting:`maxConns` runtime options: + + ..code-block:: javascript + + :option:`--maxConns ` Review and Set Resource Limits ------------------------------ - ``ulimit`` ~~~~~~~~~~ You can use the ``ulimit`` command at the system prompt to check -system limits, as in the following example +system limits, as in the following example: .. code-block:: sh @@ -90,13 +94,13 @@ system limits, as in the following example ``ulimit`` refers to the per-*user* limitations for various resources. Therefore, if your :program:`mongod` instance executes as a -user that is also running other processes, you can see some contention +user that is also running other processes, you might see some contention for these resources. Also, be aware that the ``processes`` value (i.e. ``-u``) refers to the combined number of distinct processes and sub-process threads. You can change ``ulimit`` settings by issuing a command in the -following form: :: +following form: .. code-block:: sh @@ -115,6 +119,10 @@ Substitute the ``-n`` option for any possible value in the output of ``/proc`` File System ~~~~~~~~~~~~~~~~~~~~~ +.. note:: + + This section applies only to Linux operating systems. + The ``/proc`` file-system stores the per-process limits in the file system object located at ``/proc//limits``, where ```` is the processes :term:`PID` or process identifier. You can use the @@ -141,7 +149,7 @@ object for a process or processes with a given name: } -You can copy and paste this function into a current shell session, or +You can copy and paste this function into a current shell session or load it as part of a script. Call the function with one the following invocations: