4

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.

1

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.

  • The load is >90% mongod and child processes (seeing this every time when using htop, not actually logged). However as I pointed out it is not actually a problem because the load is so low. It might have been something like extra writes or something, but it seems that there shouldn't be a difference just from the replica set. So I'll accept this answer. – p.streef Jun 18 '16 at 8:01
0

Having mongo as a replica set allows for: (this things will be unavailable in single instance)

  1. Overcome failure of a master system (with low latency)
  2. have data distributed (in two/three different data centres)
  3. Split load and allow to query secondaries
  4. Overcome network segmentation issues

When you switch to one instance - whatever will stop the only one instance, will stop your underlying application/s too - as long as it is not critical for business and risk is accepted - that's fine :-)

  • I was actually talking about a replica set with a single node. Since (as explained in my question) I found a difference in cpu load when downgrading when i switched from replica to stand alone mode. This was after I already removed the other nodes. Obviously this won't make use of the replication, but there must be something else that makes it use less CPU. Or perhaps it was just chance.. – p.streef Jun 16 '16 at 6:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.