Skip to content

Define MongoDB page faults #1878

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

Closed
Closed
Show file tree
Hide file tree
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
33 changes: 20 additions & 13 deletions source/administration/monitoring.txt
Original file line number Diff line number Diff line change
Expand Up @@ -434,15 +434,21 @@ affect performance.
Page Faults
~~~~~~~~~~~

A page fault occurs when MongoDB requires data
not located in physical memory, and must read from virtual memory. To
check for page faults, see the :data:`extra_info.page_faults
<serverStatus.extra_info.page_faults>` value in the
:dbcommand:`serverStatus` output. This data is only available on
Linux systems.
.. include:: /includes/fact-page-fault.rst

.. we should reverify the previous statement as the info is appearing
on OS X as well
Page faults triggered by MongoDB are reported as the total number of page
faults in one second. To check for page faults, see the
:data:`extra_info.page_faults <serverStatus.extra_info.page_faults>` value
in the :dbcommand:`serverStatus` output.

MongoDB on Windows counts both hard and soft page faults.

The MongoDB page fault counter may increase dramatically in moments of
poor performance and may correlate with limited physical memory
environments. Page faults also can increase while accessing much larger
data sets, for example, scanning an entire collection. Limited and
sporadic MongoDB page faults do not necessarily indicate a problem or a
need to tune the database.

A single page fault completes quickly and is not problematic. However, in
aggregate, large volumes of page faults typically indicate that MongoDB
Expand All @@ -452,11 +458,12 @@ read and avoid blocking while waiting for the next page to read into
memory. This approach improves concurrency, and also improves overall
throughput in high volume systems.

Increasing the amount of RAM accessible to MongoDB may
help reduce the number of page faults. If this is not possible, you
may want to consider deploying a :term:`sharded cluster` and/or
adding :term:`shards <shard>` to your deployment to
distribute load among :program:`mongod` instances.
Increasing the amount of RAM accessible to MongoDB may help reduce the
frequency of page faults. If this is not possible, you may want to consider
deploying a :term:`sharded cluster` or adding :term:`shards <shard>`
to your deployment to distribute load among :program:`mongod` instances.

See :ref:`faq-storage-page-faults` for more information.

Number of Connections
~~~~~~~~~~~~~~~~~~~~~
Expand Down
7 changes: 5 additions & 2 deletions source/faq/storage.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ documents. Data that isn't accessed is *not* mapped to memory.
What are page faults?
---------------------

Page faults will occur if you're attempting to access part of a
memory-mapped file that *isn't* in memory.
.. include:: /includes/fact-page-fault.rst

If there is free memory, then the operating system can find the page
on disk and load it to memory directly. However, if there is no free
Expand All @@ -60,6 +59,8 @@ This process, particularly on an active system can take a long time,
particularly in comparison to reading a page that is already in
memory.

See :ref:`administration-monitoring-page-faults` for more information.

What is the difference between soft and hard page faults?
---------------------------------------------------------

Expand All @@ -70,6 +71,8 @@ data. A "soft" page fault, by contrast, merely moves memory pages from
one list to another, such as from an operating system file
cache. In production, MongoDB will rarely encounter soft page faults.

See :ref:`administration-monitoring-page-faults` for more information.

.. _faq-tools-for-measuring-storage-use:

What tools can I use to investigate storage use in MongoDB?
Expand Down
4 changes: 4 additions & 0 deletions source/includes/fact-page-fault.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Page faults can occur as MongoDB reads from or writes data to parts of its
data files that are not currently located in physical memory. In contrast,
operating system page faults happen when physical memory is exhausted and
pages of physical memory are swapped to disk.
9 changes: 5 additions & 4 deletions source/reference/glossary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ Glossary
moving a document when it grows as the result of
:method:`~db.collection.update()`
operations. See :ref:`write-operations-padding-factor`.

padding factor
An automatically-calibrated constant used to determine how much
extra space MongoDB should allocate per document container on disk.
Expand All @@ -551,9 +551,10 @@ Glossary
:ref:`write-operations-padding-factor`.

page fault
The event that occurs when a process requests stored data
(i.e. a page) from memory that the operating system has moved to
disk. See :ref:`faq-storage-page-faults`.
.. include:: /includes/fact-page-fault.rst

See :ref:`administration-monitoring-page-faults` and
:ref:`faq-storage-page-faults`.

partition
A distributed system architecture that splits data into ranges.
Expand Down