Replica set on web applications

good afternoon
I have problem to connect the web app to replica set setup. e are using Mongodb to login our users and manage our app. On web app we are using PHP driver and mongoDB is setup with PSA(primary-secondary-arbiter, where each db is on different server). When both primary and secondary database are up the response and visual for the app are great . When I shut down one of the server, the response are slow and the app did not show correctly ( the connection string is setup for replica set). When I change the connection string from replica set to standalone (for active DB) the app respond and show correctly.

Am I something missing on configuration on mongoDB replica set? Or do I need something add to the PHP? here is the PHP conn.
$mongo_client = new MongoDB\Client($config->connectionString);
$db = $mongo_client->selectDatabase($config->databaseName);

connectionString - "mongodb://user:passs@firstserver,secondserverI?replicaSet=maintest&readPreference=nearest

Hi @Jan_Perdok

PSA is not a recommended deployment for a replica set for a couple of reasons this being one of them. The use of PSA comes with some trade offs. Now days you will have to take action to remove the performance impact if the secondary goes down.

Performance Issues with PSA replica sets

If you are using a three-member primary-secondary-arbiter (PSA) architecture, the write concern "majority" can cause performance issues if a secondary is unavailable or lagging. See Mitigate Performance Issues with PSA Replica Set for advice on how to mitigate these issues.

Have a read of this for the performance issues.

1 Like

@chris thanks for the answer . So what is better for replica set with two mongo database if one goes down and the other one would continue for the connection?teh cluster set? Or can you recommend me the config for my solution? thank you