Skip to content

DOCS-471: ulimit page: edits #299

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 9, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 27 additions & 19 deletions draft/administration/ulimit.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -13,35 +13,37 @@ 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 <replica set>`, 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 <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.

- 1 file descriptor for each data file in used by the
: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 <ttl-collections>` and replication
:program:`mongod` uses threads for a number of internal processes,
including :ref:`TTL collections <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.

Expand All @@ -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
<mongos --maxConns>`.)
:setting:`maxConns` runtime options:

..code-block:: javascript

:option:`--maxConns <mongos --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

Expand All @@ -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

Expand All @@ -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/<pid>/limits``, where ``<pid>``
is the processes :term:`PID` or process identifier. You can use the
Expand All @@ -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:

Expand Down