Skip to content

Commit dbbb35b

Browse files
author
Sam Kleinman
committed
DOCS-471 changes to ulimit page and publishing.
1 parent 5f1ca9f commit dbbb35b

File tree

2 files changed

+39
-36
lines changed

2 files changed

+39
-36
lines changed

source/administration.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ The following documents outline basic MongoDB administrative topics:
1919
administration/monitoring
2020
administration/import-export
2121
administration/backups
22+
administration/ulimit
2223

2324
.. seealso::
2425

draft/administration/ulimit.txt renamed to source/administration/ulimit.txt

Lines changed: 38 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22
Linux ``ulimit`` Settings
33
=========================
44

5+
.. default-domain:: mongodb
6+
57
The Linux kernel provides a system to limit and control the number of
68
threads, connections, and open files on a per-process and per-user
7-
basis. These limits prevent renegade processes from using too many
8-
system resources. Sometimes, these limits, as configured by the
9-
distribution developers, are too low for MongoDB and can cause a
10-
number of issues in the course of normal MongoDB operation.
9+
basis. These limits prevent single users from using too many system
10+
resources. Sometimes, these limits, as configured by the distribution
11+
developers, are too low for MongoDB and can cause a number of issues
12+
in the course of normal MongoDB operation. Generally, MongoDB should
13+
be the only user process on a system, to prevent resource contention.
1114

1215
Resource Utilization
1316
--------------------
@@ -18,56 +21,54 @@ section outlines the general resource utilization patterns for MongoDB.
1821
Use these figures in combination with the actual information about your
1922
deployment and its use to determine ideal ``ulimit`` settings.
2023

21-
``mongod``
22-
~~~~~~~~~~
23-
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>`.
27-
28-
In :term:`sharded clusters <shard cluster>`, :program:`mongod`
29-
instances use 1 thread for each :program:`mongos`.
24+
Generally, all :program:`mongod` and :program:`mongos` instances, like
25+
other processes:
3026

31-
- 1 thread for each outgoing connection to a :program:`mongod`
32-
in a replica set.
27+
- tracks each incoming connection with a file descriptor *and* a thread.
3328

34-
In sharded clusters, :program:`mongod` instances use 1 file
35-
descriptor for each :program:`mongos`.
29+
- tracks each internal thread or *pthread* as a system process.
3630

37-
- 1 file descriptor for each incoming connection.
31+
``mongod``
32+
~~~~~~~~~~
3833

3934
- 1 file descriptor for each data file in use by the
4035
:program:`mongod` instance.
4136

4237
- 1 file descriptor for each journal file used by the
4338
:program:`mongod` instance when :setting:`journal` is ``true``.
4439

45-
:program:`mongod` uses threads for a number of internal processes,
46-
including :ref:`TTL collections <ttl-collections>` and replication,
47-
which may require a small number of additional resources.
40+
- In replica sets, each :program:`mongod` maintains a connection to
41+
all other members of the set.
42+
43+
:program:`mongod` uses background threads for a number of internal
44+
processes, including :ref:`TTL collections <ttl-collections>` and
45+
replication, replica set health checks, which may require a small
46+
number of additional resources.
4847

4948
``mongos``
5049
~~~~~~~~~~
5150

52-
- 1 thread for each incoming connection from a client.
53-
54-
- 1 file descriptor for each incoming connection.
55-
56-
- 1 file descriptor for each connection to each member of each
57-
shard.
51+
In addition to the threads and file descriptors for client
52+
connections, :program:`mongos` must maintain connects to all config
53+
servers, and all shards, which includes all members of all replica
54+
sets.
5855

5956
For :program:`mongos`, consider the following behaviors:
6057

6158
- :program:`mongos` instances maintain a connection pool to each shard
6259
so that the :program:`mongos` can reuse connections and quickly
6360
fulfill requests without needing to create new connections.
6461

65-
- The size of the connection pool is configurable with the
66-
:setting:`maxConns` runtime options:
62+
- You can limit the number of incoming connections using
63+
the :setting:`maxConns` run-time option:
64+
65+
.. code-block:: javascript
6766

68-
..code-block:: javascript
67+
:option:`--maxConns <mongos --maxConns>`
6968

70-
:option:`--maxConns <mongos --maxConns>`
69+
By restricting the number of incoming connections you can prevent a
70+
cascade effect where the :program:`mongos` creates too many
71+
connections on the :program:`mongod` instances.
7172

7273
Review and Set Resource Limits
7374
------------------------------
@@ -100,10 +101,11 @@ system limits, as in the following example:
100101

101102
``ulimit`` refers to the per-*user* limitations for various
102103
resources. Therefore, if your :program:`mongod` instance executes as a
103-
user that is also running other processes, you might see some contention
104-
for these resources. Also, be aware that the ``processes`` value
105-
(i.e. ``-u``) refers to the combined number of distinct processes and
106-
sub-process threads.
104+
user that is also running multiple process, or multiple
105+
:program:`mongod` process, you might see contention for these
106+
resources. Also, be aware that the ``processes`` value (i.e. ``-u``)
107+
refers to the combined number of distinct processes and sub-process
108+
threads.
107109

108110
You can change ``ulimit`` settings by issuing a command in the
109111
following form:
@@ -203,7 +205,7 @@ the following thresholds and settings are particularly important for
203205
- ``-f`` (file size): ``unlimited``
204206
- ``-t`` (cpu time): ``unlimited``
205207
- ``-v`` (virtual memory): ``unlimited``
206-
- ``-n`` (open files): ``21000``
208+
- ``-n`` (open files): ``64000``
207209
- ``-m`` (memory size): ``unlimited``
208210
- ``-u`` (processes/threads): ``32000``
209211

0 commit comments

Comments
 (0)