Skip to content

Commit d162c2b

Browse files
kennethdyermdb-ashleyKenneth P. J. Dyer
authored
DOCSP-24317 FAQ Diagnostic for tcp_retries2 (#3503)
* DOCSP-24317 tcp_retries2 FAQ * tcp_retries adjustment in Linux * Documents windows tcp_retries adjustment * Minor edits * Minor edits * Fixes per Ashley Co-authored-by: Ashley Brown <[email protected]> * io code-block setup * Fixes build issue * Fixes rendering issue * Fixes per Shane Harvey --------- Co-authored-by: Ashley Brown <[email protected]> Co-authored-by: Kenneth P. J. Dyer <[email protected]>
1 parent 45c7ffe commit d162c2b

File tree

3 files changed

+107
-0
lines changed

3 files changed

+107
-0
lines changed

source/faq/diagnostics.txt

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,46 @@ Adjusting the TCP keepalive value:
7676
You will need to restart :binary:`~bin.mongod` and :binary:`~bin.mongos`
7777
processes for new system-wide keepalive settings to take effect.
7878

79+
.. _faq-tcp_retries2:
80+
81+
Do TCP Retransmission Timeouts affect MongoDB Deployments?
82+
----------------------------------------------------------
83+
84+
If you experience long stalls (stalls greater than two minutes) followed
85+
by network timeouts or socket errors between clients and server
86+
or between members of a sharded cluster or replica set,
87+
check the ``tcp_retries2`` value for the affected systems.
88+
89+
Most Linux operating systems set this value to ``15`` by default, while
90+
Windows sets it to ``5``. For MongoDB, you experience better results
91+
with a lower ``tcp_retries2`` value, on the order of ``5`` (12 seconds)
92+
or lower.
93+
94+
If your MongoDB deployment experiences TCP retransmission timeout-related
95+
issues, change the ``tcp_retries2`` value (``TcpMaxDataRetransmission``
96+
on Windows) for *all* affected systems. This includes all machines running
97+
:binary:`~bin.mongod` or :binary:`~bin.mongos` processes and
98+
all machines hosting client processes that connect to MongoDB.
99+
100+
Adjust the TCP Retransmission Timeout
101+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
102+
103+
.. tabs::
104+
105+
.. tab:: Linux
106+
:tabid: linux
107+
108+
.. include:: /includes/fact-tcp-retries-linux.rst
109+
110+
.. tab:: Windows
111+
:tabid: windows
112+
113+
.. include:: /includes/fact-tcp-retries-windows.rst
114+
115+
116+
117+
118+
79119
Why does MongoDB log so many "Connection Accepted" events?
80120
----------------------------------------------------------
81121

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
2+
On most Linux operating systems, control the TCP retransmission
3+
by adjusting the ``net.ipv4.tcp_retries2`` sysctl setting.
4+
5+
.. note::
6+
7+
Although the setting name includes ``ipv4``, the ``tcp_retries2`` setting
8+
applies to both IPv4 and IPv6.
9+
10+
- To view the current setting, use the ``sysctl`` command:
11+
12+
.. io-code-block::
13+
14+
.. input::
15+
:language: bash
16+
17+
sysctl net.ipv4.tcp_retries2
18+
19+
.. output::
20+
:language: bash
21+
22+
net.ipv4.tcp_retries = 15
23+
24+
- To change the ``tcp_retries2`` setting at runtime, use the ``sysctl`` command:
25+
26+
.. code-block:: bash
27+
28+
sysctl -w net.ipv4.tcp_retries2=8
29+
30+
- To make the change permanent, edit the configuration file:
31+
32+
#. Open ``/etc/sysctl.conf`` in your preferred text editor:
33+
34+
.. code-block:: bash
35+
36+
vi /etc/sysctl.conf
37+
38+
#. Configure the ``net.ipv4.tcp_retries2`` setting:
39+
40+
.. code-block:: conf
41+
42+
net.ipv4.tcp_retries2 = 8
43+
44+
#. Restart the system.
45+
46+
Your system now uses the new ``tcp_retries2`` setting.
47+
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
On Windows, control TCP Retransmission by adjusting the
2+
``TcpMaxDataRetransmissions`` parameter.
3+
4+
- To view the ``TcpMaxDataRetransmissions`` setting on Windows, issue the
5+
following command:
6+
7+
.. code-block:: powershell
8+
9+
reg query HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters /v TcpMaxDataRetransmissions
10+
11+
By default, the parameter is not set. The system default,
12+
used if the value is absent, is ``5`` retries.
13+
14+
- To change the ``TcpMaxDataRetransmissions`` value, use the following command
15+
in an Administrator :guilabel:`Command Prompt`, where ``<value>`` is an integer:
16+
17+
.. code-block:: powershell
18+
19+
reg add HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\ /t REG_DWORD /v TcpMaxDataRetransmission /d <value>
20+

0 commit comments

Comments
 (0)