> For the complete MongoDB documentation index, see www.mongodb.com/docs/llms.txt

# Mitigate Performance Issues in Self-Managed PSA Replica Sets

## Overview

In a three-member replica set with a primary-secondary-arbiter (PSA) architecture or a sharded cluster with three-member PSA shards, a data-bearing node that is down or lagged can lead to performance issues.

If one data-bearing node goes down, the other node becomes the primary. Writes with [`w:1`](https://www.mongodb.com/docs/manual/reference/write-concern.md#mongodb-writeconcern-writeconcern.-number-) continue to succeed in this state but writes with write concern [`"majority"`](https://www.mongodb.com/docs/manual/reference/write-concern.md#mongodb-writeconcern-writeconcern.-majority-) cannot succeed and the commit point starts to lag. If your PSA replica set contains a lagged secondary and your replica set requires two nodes to majority commit a change, your commit point also lags.

With a lagged commit point, two things can affect your cluster performance:

- The storage engine keeps **all** changes that happen after the commit point on disk to retain a [durable](https://www.mongodb.com/docs/manual/reference/glossary.md#std-term-durable) history. The extra I/O from these writes tends to increase over time. This can greatly impact write performance and increase cache pressure.

- MongoDB allows the [oplog](https://www.mongodb.com/docs/manual/core/replica-set-oplog.md#std-label-replica-set-oplog) to grow past its configured size limit to avoid deleting the [`majority commit point`.](https://www.mongodb.com/docs/manual/reference/command/replsetgetstatus.md#mongodb-data-replSetGetStatus.optimes.lastCommittedOpTime)

To reduce the cache pressure and increased write traffic, set [`votes: 0`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.members-n-.votes) and [`priority: 0`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.members-n-.priority) for the node that is unavailable or lagging. For write operations issued with "majority", only voting members are considered to determine the number of nodes needed to perform a majority commit. Setting the configuration of the node to [`votes: 0`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.members-n-.votes) reduces the number of nodes required to commit a write with write concern [`"majority"`](https://www.mongodb.com/docs/manual/reference/write-concern.md#mongodb-writeconcern-writeconcern.-majority-) from two to one and allows these writes to succeed.

Once the secondary is caught up, you can use the [`rs.reconfigForPSASet()`](https://www.mongodb.com/docs/manual/reference/method/rs.reconfigforpsaset.md#mongodb-method-rs.reconfigForPSASet) method to set [`votes`](https://www.mongodb.com/docs/manual/reference/replica-configuration.md#mongodb-rsconf-rsconf.members-n-.votes) back to `1`.

**Note:**

In earlier versions of MongoDB, [`enableMajorityReadConcern`](https://www.mongodb.com/docs/manual/reference/configuration-options.md#mongodb-setting-replication.enableMajorityReadConcern) and [`--enableMajorityReadConcern`](https://www.mongodb.com/docs/manual/reference/program/mongod.md#std-option-mongod.--enableMajorityReadConcern) were configurable allowing you to disable the default read concern [`"majority"`](https://www.mongodb.com/docs/manual/reference/read-concern-majority.md#mongodb-readconcern-readconcern.-majority-) which had a similar effect.

## Procedure

To reduce the cache pressure and increased write traffic for a deployment with a three-member primary-secondary-arbiter (PSA) architecture, set `{ votes: 0, priority: 0 }` for the secondary that is unavailable or lagging:

```javascript
cfg = rs.conf();
cfg["members"][<array_index>]["votes"] = 0;
cfg["members"][<array_index>]["priority"] = 0;
rs.reconfig(cfg);
```

If you want to change the configuration of the secondary later, use the [`rs.reconfigForPSASet()`](https://www.mongodb.com/docs/manual/reference/method/rs.reconfigforpsaset.md#mongodb-method-rs.reconfigForPSASet) method.
