Mongodb Standalone Performs better than Replica Set
I would like to know what could be the real reason for the replica sets to function slower compared to the standalone db.


Replica sets provide high availability and data redundancy, but these benefits are best realized using separate server resources.

With multiple data-bearing replica set members on a single server you are adding contention for the underlying hardware resources (CPU, RAM, disk):


Every write has to be replicated and applied by each of the replica set members (which each have their own journal, oplog, and data files), so there will be significantly more I/O as compared to a standalone server.
A replica set on a single server will be using RAM to store multiple copies of the same data; a standalone can have more of your data &amp; indexes in the same amount of RAM.


If the reason for your performance challenge is a lack of resources, you should be adding dedicated resources (such as more RAM or faster storage) rather than sharing existing resources.

Note that even with replica set members on multiple servers, secondary reads are not a panacea. For some considerations, see: Can I use more replica nodes to scale?.

Before adding additional server resources, I recommend starting with optimising indexes to support your common queries and aggregations. See: Index Strategies in the MongoDB documentation.