diff --git a/source/reference/log-messages.txt b/source/reference/log-messages.txt index 7fa43905388..c11e50962b7 100644 --- a/source/reference/log-messages.txt +++ b/source/reference/log-messages.txt @@ -867,6 +867,38 @@ See the :ref:`examples section ` for a :ref:`pretty-printed ` version of this log entry. +.. _log-messages-remoteOpWaitMillis: + +Time Waiting for Shards Logged in ``remoteOpWaitMillis`` Field +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. versionadded:: 5.0 + +Starting in MongoDB 5.0, you can use the ``remoteOpWaitMillis`` log +field to obtain the wait time (in milliseconds) for results from +:term:`shards `. + +``remoteOpWaitMillis`` is only logged: + +- If you configure :ref:`slow operations logging + `. + +- On the :term:`shard` or :binary:`~bin.mongos` that merges the results. + +To determine if a merge operation or a shard issue is causing a slow +query, compare the ``durationMillis`` and ``remoteOpWaitMillis`` time +fields in the log. ``durationMillis`` is the total time the query took +to complete. Specifically: + +- If ``durationMillis`` is slightly longer than ``remoteOpWaitMillis``, + then most of the time was spent waiting for a shard response. For + example, ``durationMillis`` of 17 and ``remoteOpWaitMillis`` of 15. + +- If ``durationMillis`` is significantly longer than + ``remoteOpWaitMillis``, then most of the time was spent performing the + merge. For example, ``durationMillis`` of 100 and + ``remoteOpWaitMillis`` of 15. + .. _log-message-parsing: Parsing Structured Log Messages diff --git a/source/release-notes/5.0.txt b/source/release-notes/5.0.txt index d6ffa82e84c..a8277f75c0a 100644 --- a/source/release-notes/5.0.txt +++ b/source/release-notes/5.0.txt @@ -648,6 +648,13 @@ Starting in MongoDB 5.0, :ref:`slow operation ` log messages include a ``remote`` field specifying client IP address. +``remoteOpWaitMillis`` Log Field +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Starting in MongoDB 5.0, you can use the :ref:`remoteOpWaitMillis +` log field to obtain the wait time for +results from :term:`shards `. + Define Variables Using the ``let`` Option ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~