@@ -3,7 +3,7 @@ Linux ``ulimit`` Settings
3
3
=========================
4
4
5
5
The 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
7
7
basis. These limits prevent renegade processes from using too many
8
8
system resources. Sometimes, these limits, as configured by the
9
9
distribution developers, are too low for MongoDB and can cause a
@@ -13,35 +13,37 @@ Resource Utilization
13
13
--------------------
14
14
15
15
: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.
19
20
20
21
``mongod``
21
22
~~~~~~~~~~
22
23
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>`.
25
27
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.
28
30
29
31
- 1 file descriptor for each incoming connection.
30
32
31
33
- 1 file descriptor for each data file in used by the
32
34
:program:`mongod` instance.
33
35
34
36
- 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``.
36
38
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,
39
41
which may require a small number of additional resources.
40
42
41
43
``mongos``
42
44
~~~~~~~~~~
43
45
44
- - 1 thread for each incoming connection from clients .
46
+ - 1 thread for each incoming connection from a client .
45
47
46
48
- 1 file descriptor for each incoming connection.
47
49
@@ -55,18 +57,20 @@ For :program:`mongos`, consider the following behaviors:
55
57
fulfill requests without needing to create new connections.
56
58
57
59
- 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>`
60
65
61
66
Review and Set Resource Limits
62
67
------------------------------
63
68
64
-
65
69
``ulimit``
66
70
~~~~~~~~~~
67
71
68
72
You 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:
70
74
71
75
.. code-block:: sh
72
76
@@ -90,13 +94,13 @@ system limits, as in the following example
90
94
91
95
``ulimit`` refers to the per-*user* limitations for various
92
96
resources. 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
94
98
for these resources. Also, be aware that the ``processes`` value
95
99
(i.e. ``-u``) refers to the combined number of distinct processes and
96
100
sub-process threads.
97
101
98
102
You can change ``ulimit`` settings by issuing a command in the
99
- following form: ::
103
+ following form:
100
104
101
105
.. code-block:: sh
102
106
@@ -115,6 +119,10 @@ Substitute the ``-n`` option for any possible value in the output of
115
119
``/proc`` File System
116
120
~~~~~~~~~~~~~~~~~~~~~
117
121
122
+ .. note::
123
+
124
+ This section applies only to Linux operating systems.
125
+
118
126
The ``/proc`` file-system stores the per-process limits in the
119
127
file system object located at ``/proc/<pid>/limits``, where ``<pid>``
120
128
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:
141
149
142
150
}
143
151
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
145
153
load it as part of a script. Call the function with one the following
146
154
invocations:
147
155
0 commit comments