Mongodb – the difference between mongod in standalone vs replica set

mongodbreplication

I've been running Mongodb as a replica set on 3 servers (primary, secondary and arbiter) but because I have to downscale I'm converting the primary to a standalone server. Before this change the replica set secondary was just a "backup" in case of primary failure, so no distribution of reads.

I was expecting the CPU load on my primary server to go down or stay the same. However it went up a bit instead (before my "uptime" load rating would be around 0.01, now it's usually around 0.1- 0.2). Not a problem, but stil significant.

So what exactly is the difference in running mongod as a replica set vs a standalone server? And are there drawbacks to running mongod as a single node "fake" replica set?

I'm using the MongoRocks storage engine.

Best Answer

Switching a primary in a replica set to a standalone will not impact CPU unless you were offloading something to the secondaries that will now hit the standalone node like reads or Map Reduce (and you mention you were not). As well as that, mongod is generally not CPU intensive unless you are doing lots of sorts or distincts (or a lot of javascript, Map Reduce etc.). If you are just doing reads/writes then the CPU usage will be minimal.

The load metrics mentioned are both very low, and indicate the server is doing very little - that kind of difference could come from users doing things even. To be completely sure, use the mongod normally and check out what it is doing with CPU in top, I suspect it won't be using CPU heavily.

If there is a difference, then my final suspect would be a slight increase in write load or similar - depending on the options used, the non-MMAP engines can use a little more CPU when writing data (using compression, or cleaning up data on the filesystem). If your write load has not increased then that's probably not the issue.