@@ -3,7 +3,7 @@ Linux ``ulimit`` Settings
33=========================
44
55The Linux kernel provides a system to limit and control the number of
6- threads, connections, open files, on a per-process and per-user
6+ threads, connections, and open files on a per-process and per-user
77basis. These limits prevent renegade processes from using too many
88system resources. Sometimes, these limits, as configured by the
99distribution developers, are too low for MongoDB and can cause a
@@ -13,35 +13,37 @@ Resource Utilization
1313--------------------
1414
1515:program:`mongod` and :program:`mongos` each use threads and file
16- descriptors to track connections, and manage internal operations. This
17- section outlines the general resource utilization patterns for
18- MongoDB. Use these figures in combination with the actual
16+ descriptors to track connections and manage internal operations. This
17+ section outlines the general resource utilization patterns for MongoDB.
18+ Use these figures in combination with the actual information about your
19+ deployment and its use to determine ideal ``ulimit`` settings.
1920
2021``mongod``
2122~~~~~~~~~~
2223
23- - 1 thread for each incoming connection from clients and, for
24- :term:`replica sets <replica set>`, other :program:`mongod` instances.
24+ - 1 thread for each incoming connection from a client and for
25+ each incoming connection from a :program:`mongod` instance in a
26+ :term:`replica set <replica set>`.
2527
26- - 1 thread for each outgoing connection to another :program:`mongod`
27- when running in a replica set.
28+ - 1 thread for each outgoing connection to a :program:`mongod`
29+ in a replica set.
2830
2931- 1 file descriptor for each incoming connection.
3032
3133- 1 file descriptor for each data file in used by the
3234 :program:`mongod` instance.
3335
3436- 1 file descriptor for each journal file used by the
35- :program:`mongod` instance ( when :setting:`journal` is ``true``.)
37+ :program:`mongod` instance when :setting:`journal` is ``true``.
3638
37- :program:`mongod` uses threads for a number of internal processes
38- including :ref:`TTL collections <ttl-collections>` and replication
39+ :program:`mongod` uses threads for a number of internal processes,
40+ including :ref:`TTL collections <ttl-collections>` and replication,
3941which may require a small number of additional resources.
4042
4143``mongos``
4244~~~~~~~~~~
4345
44- - 1 thread for each incoming connection from clients .
46+ - 1 thread for each incoming connection from a client .
4547
4648- 1 file descriptor for each incoming connection.
4749
@@ -55,18 +57,20 @@ For :program:`mongos`, consider the following behaviors:
5557 fulfill requests without needing to create new connections.
5658
5759- The size of the connection pool is configurable with the
58- :setting:`maxConns` runtime options (i.e. :option:`--maxConns
59- <mongos --maxConns>`.)
60+ :setting:`maxConns` runtime options:
61+
62+ ..code-block:: javascript
63+
64+ :option:`--maxConns <mongos --maxConns>`
6065
6166Review and Set Resource Limits
6267------------------------------
6368
64-
6569``ulimit``
6670~~~~~~~~~~
6771
6872You can use the ``ulimit`` command at the system prompt to check
69- system limits, as in the following example
73+ system limits, as in the following example:
7074
7175.. code-block:: sh
7276
@@ -90,13 +94,13 @@ system limits, as in the following example
9094
9195``ulimit`` refers to the per-*user* limitations for various
9296resources. Therefore, if your :program:`mongod` instance executes as a
93- user that is also running other processes, you can see some contention
97+ user that is also running other processes, you might see some contention
9498for these resources. Also, be aware that the ``processes`` value
9599(i.e. ``-u``) refers to the combined number of distinct processes and
96100sub-process threads.
97101
98102You can change ``ulimit`` settings by issuing a command in the
99- following form: ::
103+ following form:
100104
101105.. code-block:: sh
102106
@@ -115,6 +119,10 @@ Substitute the ``-n`` option for any possible value in the output of
115119``/proc`` File System
116120~~~~~~~~~~~~~~~~~~~~~
117121
122+ .. note::
123+
124+ This section applies only to Linux operating systems.
125+
118126The ``/proc`` file-system stores the per-process limits in the
119127file system object located at ``/proc/<pid>/limits``, where ``<pid>``
120128is 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:
141149
142150 }
143151
144- You can copy and paste this function into a current shell session, or
152+ You can copy and paste this function into a current shell session or
145153load it as part of a script. Call the function with one the following
146154invocations:
147155
0 commit comments