I deployed the version of 64-bit version 2.x mongodb in the aws m1.large instance.
I'm trying to find the best performance that mongo can give us on aws in light of http://www.snailinaturtleneck.com/blog/tag/mongodb/ (and mongodb read / write performance and mongo hosting in the cloud )
I created one db with one collection, that is, a user, and inserted 100,000 records / json object (each json object size is 4 KB) using a random number as a suffix for "user-". In addition, an index has been created for the user ID.
In addition, I installed db profiler to register a slow request that takes 20 ms or more. I executed a java program with 10 threads. Each java class generates a user ID with a random number and finds it in the user collection in an infinite loop. With such a load, I observed a delay in the request / read of up to 60 ms.
I also noticed that when I start fewer threads, say 3 or 4 (with loading requests to the user collection 5K per second to search for users), I do not see a delay or less than 2 ms latency.
I did not understand why an increase in the load on searching a user in a collection causes latency. I believe that mongo db can do much more parallel reading, and then what I try and should not affect performance as such.
One of the possibilities that I suppose will be that mongo has performance problems if large requests are executed in one collection, as in our case, I expect that from 10 to 20 thousand requests will be requested in one collection per second.
We will be grateful for your thoughts / suggestions.
source share