Skip to content

Commit 8ab08b2

Browse files
committed
DOCS-14598: Address eMRC=true PSA cache pressure
1 parent e929c80 commit 8ab08b2

File tree

10 files changed

+124
-49
lines changed

10 files changed

+124
-49
lines changed

source/administration/replica-set-maintenance.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ replica sets.
5757
primary-secondary-arbiter (PSA) replica set or on a replica set that
5858
is changing to a PSA architecture.
5959

60+
:doc:`/tutorial/mitigate-psa-performance-issues`
61+
Prevent storage cache pressure from immobilizing a deployment that has
62+
a three-member primary-secondary-arbiter (PSA) architecture.
63+
6064
.. toctree::
6165
:titlesonly:
6266
:hidden:
@@ -72,3 +76,4 @@ replica sets.
7276
/tutorial/configure-replica-set-secondary-sync-target
7377
/tutorial/rename-unsharded-replica-set
7478
/tutorial/modify-psa-replica-set-safely
79+
/tutorial/mitigate-psa-performance-issues

source/core/replica-set-arbiter.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ number of votes to break a tie:
4848

4949
.. end-content-even-votes-example
5050

51+
Performance Issues with PSA replica sets
52+
----------------------------------------
53+
54+
.. include:: /includes/fact-psa-performance-issues.rst
55+
5156
Replica Set Protocol Version and Arbiter
5257
-----------------------------------------
5358

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
If you are using a three-member primary-secondary-arbiter (PSA)
2+
architecture, the read concern :readconcern:`"majority"` can cause
3+
performance issues if a secondary is unavailable or lagging. See
4+
:ref:`performance-issues-psa` for advice on how to mitigate these
5+
issues.

source/reference/configuration-options.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4145,6 +4145,10 @@ LDAP Parameters
41454145
and is always set to ``true``. In earlier versions of MongoDB,
41464146
:setting:`~replication.enableMajorityReadConcern` was configurable.
41474147

4148+
.. warning::
4149+
4150+
.. include:: /includes/fact-psa-performance-issues.rst
4151+
41484152

41494153
``sharding`` Options
41504154
~~~~~~~~~~~~~~~~~~~~

source/reference/program/mongod.txt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1837,12 +1837,17 @@ Replication Options
18371837
*Default*: true
18381838

18391839
Configures support for :readconcern:`"majority"` read concern.
1840-
1841-
Starting in MongoDB 5.0,
1842-
:option:`--enableMajorityReadConcern` cannot be changed
1843-
and is always set to ``true``. In earlier versions of MongoDB,
1840+
1841+
Starting in MongoDB 5.0,
1842+
:option:`--enableMajorityReadConcern` cannot be changed
1843+
and is always set to ``true``. In earlier versions of MongoDB,
18441844
:option:`--enableMajorityReadConcern` was configurable.
18451845

1846+
.. warning::
1847+
1848+
.. include:: /includes/fact-psa-performance-issues.rst
1849+
1850+
18461851
Sharded Cluster Options
18471852
~~~~~~~~~~~~~~~~~~~~~~~
18481853

source/reference/read-concern-majority.txt

Lines changed: 9 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ Availability
4242
Read concern :readconcern:`"majority"` is available for use with or
4343
without causally consistent sessions and transactions.
4444

45+
.. warning::
46+
47+
.. include:: /includes/fact-psa-performance-issues.rst
48+
4549
Example
4650
-------
4751

@@ -130,48 +134,11 @@ Read Your Own Writes
130134

131135
.. include:: /includes/fact-read-own-writes.rst
132136

133-
.. _disable-read-concern-majority:
134-
135-
Disable Read Concern Majority
136-
-----------------------------
137-
138-
*For 3-Member Primary-Secondary-Arbiter Architecture*
137+
.. _disable-read-concern-majority:
138+
139+
Primary-Secondary-Arbiter Replica Sets
140+
--------------------------------------
139141

140142
.. include:: /includes/fact-eMRC-always-true-in-5.0.rst
141143

142-
You can disable read concern :readconcern:`"majority"` if you have a
143-
three-member replica set with a primary-secondary-arbiter (PSA)
144-
architecture or a sharded cluster with a three-member PSA shards.
145-
146-
.. note::
147-
148-
If you are using a deployment other than a 3-member PSA, you do not
149-
need to disable read concern majority.
150-
151-
With a three-member PSA architecture, the cache pressure will increase
152-
if any data bearing node is down. To prevent the storage cache pressure
153-
from immobilizing a deployment with a PSA architecture, you can disable
154-
read concern by setting either:
155-
156-
- :option:`--enableMajorityReadConcern <mongod
157-
--enableMajorityReadConcern>` command line option to ``false``.
158-
159-
- :setting:`replication.enableMajorityReadConcern` configuration file
160-
setting to ``false``.
161-
162-
To check if read concern "majority" is disabled, You can run
163-
:method:`db.serverStatus()` on the :binary:`~bin.mongod` instances and
164-
check the :serverstatus:`storageEngine.supportsCommittedReads` field.
165-
If ``false``, read concern "majority" is disabled.
166-
167-
.. important::
168-
169-
In general, avoid disabling :readconcern:`"majority"` read concern
170-
unless necessary. However, if you have a three-member replica set
171-
with a primary-secondary-arbiter (PSA) architecture or a sharded
172-
cluster with a three-member PSA shard, disable to prevent the
173-
storage cache pressure from immobilizing the deployment.
174-
175-
.. note:: Change Streams
176-
177-
.. include:: /includes/extracts/changestream-disable-rc-majority.rst
144+
.. include:: /includes/fact-psa-performance-issues.rst

source/release-notes/5.0-compatibility.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,14 +136,13 @@ replacement shell is :mongosh:`mongosh </>`.
136136
Shell packaging also changes in MongoDB v5.0. Refer to the
137137
:mongosh:`installation instructions </install>` for further details.
138138

139-
Replica Sets
140-
------------
141-
142139
``enableMajorityReadConcern`` Is Not Configurable
143140
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
144141

145142
.. include:: /includes/fact-eMRC-always-true-in-5.0.rst
146143

144+
.. include:: /includes/fact-psa-performance-issues.rst
145+
147146
``secondaryDelaySecs`` Configuration Setting
148147
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
149148

source/release-notes/5.0.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,8 @@ limited to an integer between ``0`` and ``255`` inclusive.
225225

226226
.. include:: /includes/fact-eMRC-always-true-in-5.0.rst
227227

228+
.. include:: /includes/fact-psa-performance-issues.rst
229+
228230
Enhanced Thread Pool Timeout Control
229231
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
230232

source/tutorial/add-replica-set-arbiter.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ server or a monitoring host.
3434
Considerations
3535
--------------
3636

37+
Primary-Secondary-Arbiter Replica Sets
38+
--------------------------------------
39+
40+
.. include:: /includes/fact-psa-performance-issues.rst
41+
3742
Replica Set Protocol Version
3843
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3944

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
.. _performance-issues-psa:
2+
3+
================================================
4+
Mitigate Performance Issues with PSA Replica Set
5+
================================================
6+
7+
.. default-domain:: mongodb
8+
9+
.. contents:: On this page
10+
:local:
11+
:backlinks: none
12+
:depth: 1
13+
:class: singlecol
14+
15+
Overview
16+
--------
17+
18+
In a three-member replica set with a primary-secondary-arbiter (PSA)
19+
architecture or a sharded cluster with three-member PSA shards, a
20+
data-bearing node that is down or lagged can lead to performance issues.
21+
22+
If one data-bearing node goes down, the other node becomes the primary.
23+
Writes with :writeconcern:`w:1 <\<number\>>` continue to succeed in this
24+
state but writes with write concern :writeconcern:`"majority"` cannot
25+
succeed and the commit point starts to lag. If your PSA replica set
26+
contains a lagged secondary and your replica set requires two nodes to
27+
majority commit a change, your commit point also lags.
28+
29+
With a lagged commit point, two things can affect your cluster
30+
performance:
31+
32+
- The storage engine keeps **all** changes that happen after the commit
33+
point on disk to retain a :term:`durable` history. The extra I/O from
34+
these writes tends to increase over time. This can greatly impact
35+
write performance and increase cache pressure.
36+
- MongoDB allows the :ref:`oplog <replica-set-oplog>` to grow past its
37+
configured size limit to avoid deleting the :data:`majority commit
38+
point <replSetGetStatus.optimes.lastCommittedOpTime>`.
39+
40+
To reduce the cache pressure and increased write traffic, set
41+
:rsconf:`votes: 0 <members[n].votes>` and :rsconf:`priority: 0
42+
<members[n].priority>` for the node that is unavailable or lagging. For
43+
write operations issued with "majority", only voting members are
44+
considered to determine the number of nodes needed to perform a majority
45+
commit. Setting the configuration of the node to :rsconf:`votes: 0
46+
<members[n].votes>` reduces the number of nodes required to commit a
47+
write with write concern :writeconcern:`"majority"` from two to one and
48+
allows these writes to succeed.
49+
50+
If you want to later change :rsconf:`votes <members[n].votes>` back to a
51+
non-zero number, use the :method:`rs.reconfigForPSASet()` method.
52+
53+
.. note::
54+
55+
In earlier versions of MongoDB,
56+
:setting:`~replication.enableMajorityReadConcern` and
57+
:option:`--enableMajorityReadConcern` were configurable allowing you
58+
to disable the default read concern :readconcern:`"majority"` which
59+
had a similar effect.
60+
61+
Procedure
62+
---------
63+
64+
To reduce the cache pressure and increased write traffic for a
65+
deployment with a three-member primary-secondary-arbiter (PSA)
66+
architecture, set ``{ votes: 0, priority: 0 }`` for the secondary that
67+
is unavailable or lagging:
68+
69+
.. code-block:: javascript
70+
71+
cfg = rs.conf();
72+
cfg["members"][<array_index>]["votes"] = 0;
73+
cfg["members"][<array_index>]["priority"] = 0;
74+
rs.reconfig(cfg);
75+
76+
77+
If you want to change the configuration of the secondary later, use the
78+
:method:`rs.reconfigForPSASet()` method.

0 commit comments

Comments
 (0)