title: Latency on aws (m1.large) with MongoDB 64b 2.x
body: <p>I have deployed mongodb 64 bit 2.x version on aws m1.large instance.</p>
  
  <p>I am trying to find best performance that mongo can give us on aws in-light of <a href="http://www.snailinaturtleneck.com/blog/tag/mongodb/" rel="nofollow noreferrer">http://www.snailinaturtleneck.com/blog/tag/mongodb/</a> (and <a href="https://stackoverflow.com/questions/2980949/mongodb-read-write-performance-and-mongo-hosting-in-the-cloud">mongodb read/write performance and mongo hosting in the cloud</a>)</p>
  
  <p>I have created one db with one collection i.e. user and inserted 100,000 records/json object (each json object size is 4KB) using random number as suffix to “user-“. Also, created index on user id.</p>
  
  <p>Further, I set db profiler to log slow query taking 20ms or more. I have executed java program with 10 threads. Each java class generates user id with random number and finds it in user collection in infinite loop.  With such load I have observed latency in query/read up-to 60ms.</p>
  
  <p>I also observed that when I run less number of threads say 3 or 4  (having query load on user collection 5K per second to find users) then I see no latency or less then 2ms latency.</p>
  
  <p>I failed to understand why increasing load of finding user in collection is causing latency. I believe that mongo db can perform much more concurrent read then what I am trying and should not impact on performance as such.</p>
  
  <p>One possibility I assume that would be - mongo is having performance issues if there are large queries executed on single collection like in our case, I expect to have 10K to 20K queries per second on single collection.</p>
  
  <p>We would appreciate your thoughts / suggestion.</p>