Note that there are some explanatory texts on larger screens.

plurals
  1. POExtraordinarily poor performance from MongoDB in write intensive application
    primarykey
    data
    text
    <p>I'm running write intensive MongoDB for a web app and I'm getting extraordinarily poor performance from it. This being said, I'm fairly certain that the problem has more to do with up our code, setup and/or our usage than in mongo itself.</p> <p>I'm about to crack my head open with a sledgehammer out of despair so I was wondering if anybody would mind looking at some of the outputs I've prepared to see if anything seems problematic.</p> <ul> <li><a href="http://www.fuitad.com/mongo/db.stats.txt" rel="nofollow">db.stats()</a></li> <li><a href="http://www.fuitad.com/mongo/fstab-mdadm-iostat.txt" rel="nofollow">fstab, mdadm and iostat -xm 2</a></li> <li><a href="http://www.fuitad.com/mongo/mongostat.txt" rel="nofollow">mongostat</a></li> </ul> <p>The code is not too complicated (it's in PHP, btw). It's pretty much a lot of ->find() and ->update(). I made sure to use indexes for both calls and confirmed they were indeed being used by doing explain() on the queries.</p> <p>I've tried 1 server (ec2 m2.2xlarge), 4 servers (2 shards of 2 reps) and 9 servers (3 shards of 3 reps) and wasn't able to get much out of those.</p> <p>On good moments, I can't get anything more than 1500 writes per second (insert + update). Most of the time, I'm lucky to reach a combined amount of 100 insert/update and I always have a big "locked %" and a lot of queries queued "qr|qw".</p> <p>Right now, I have a script that's running and it's crawling. The worst thing is, when I look at mongostat for a while, the amount of RAM used in "res" is about 50% of the server's available RAM and there's more than enough RAM to fit the indexes of all collections. There's no reason why this isn't spitting out data like crazy. </p> <p>I must have recoded the app 2-3 times already, trying to find better access patterns for the data. I've read everything I could read on indexes, updating, shard keys and what not. All the servers I put mongo on are using a 8 EBS disks raid 10 setup with some performance tweaks added (blockdev, noatime, etc…).</p> <p>I know the problem is on my end and I'm not blaming mongodb. I know bigger companies than me are using it for write intensive applications and that they absolutely love it (foursquare for example). At the same time, I just can't understand what I'm doing wrong and why I'm getting such poor performance, no matter what I do.</p> <p>Additional Info:</p> <ul> <li>All servers (client and server) are running Ubuntu 10.04 LTS with MongoDB 1.8.2</li> <li>All servers are on EC2 East and in the same zone</li> <li>Currently, I'm back at 1 m2.2xlarge server (4 cores, 34.2 GB RAM) until I can figure out where the problem is.</li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload