Very slow MongoDB replica set

mongodbreplication

I have set up two Mongo instances in EC2 having RAID10. I set up replica set using those two servers and found that this replica is very very slow over network. If I log in locally and issue query inside mongo console all is fine. I tested disk speed no issue here:

sudo dd if=/dev/zero of=/data/output2.img bs=8k count=100k
102400+0 records in
102400+0 records out
838860800 bytes (839 MB) copied, 1.87101 s, 448 MB/s

And similar set up that is without replication works fast. How can I track down this issue ?

Best Answer

This is a bit light on details - you don't mention some vital information like what exactly is slow (is this access via a driver for example). Replication adds a little load to the primary, but in general is pretty lightweight.

What size instances are you running, and where (replicating across regions etc.)? You might be saturating your available bandwidth when you add the replication data to the mix. I would only expect that though if you were running a write heavy application or if perhaps you were doing slaveOK reads.

Finally, as a general guide to running MongoDB in AWS, check out this white paper:

http://d36cz9buwru1tt.cloudfront.net/AWS_NoSQL_MongoDB.pdf

And these notes in the official docs:

http://www.mongodb.org/display/DOCS/Amazon+EC2

Related Topic