Are my MongoDB servers right in setting? I have a small web site, so I used two servers.

A: master 4G Ram, 96G SSD
B: slave 2G RAM, 96G SSD

The B server is always for backup, no read, no write.

In my application, many users can (and will) be trying to update one document at the same time by inserting a few embedded documents (objects) into it during one single update.

My questions


Are all my operations in A server Strong Consistent?
Do I need to use "fsync = true" in my code in PHP?
At first you should move to a 3 node replica set to ensure High Availability. At your case i would suggest to add an arbiter to your set, and give higher priority to the server A to ensure that will be the Primary.

1) Probably your question is about atomicity rather than consistency (correct me if i am wrong) the most safe choice is command findAndModify but you need to be careful because on high concurrency you may get delays.

2) Calling fsync in your code after every operation is a bad idea because you may get stale periods. fsync just flush the pending operations to disk, it doesn't ensure atomicity of an operation.