I am doing some tests to find out what bandwidth I can get from Mongodb. The documentation says that private collections are the fastest option. But I often find that I can write to a regular collection much faster. Depending on the exact test, I can often get twice as much bandwidth with a regular collection.
Am I missing something? How to fix this problem?
I have a very simple C ++ program that writes as many as 64,000 documents to the collection as quickly as possible. I record the total time and time expected for the database. If I do not change anything except the name of the collection, I see a clear difference between private and normal collections.
> use tutorial switched to db tutorial > db.system.namespaces.find() { "name" : "tutorial.system.indexes" } { "name" : "tutorial.persons.$_id_" } { "name" : "tutorial.persons" } { "name" : "tutorial.persons.$age_1" } { "name" : "tutorial.alerts.$_id_" } { "name" : "tutorial.alerts" } { "name" : "tutorial.capped.$_id_" } { "name" : "tutorial.capped", "options" : { "create" : "capped", "capped" : true, "size" : 100000000 } } > db.alerts.stats() { "ns" : "tutorial.alerts", "count" : 400000, "size" : 561088000, "avgObjSize" : 1402.72, "storageSize" : 629612544, "numExtents" : 16, "nindexes" : 1, "lastExtentSize" : 168730624, "paddingFactor" : 1, "systemFlags" : 1, "userFlags" : 0, "totalIndexSize" : 12991664, "indexSizes" : { "_id_" : 12991664 }, "ok" : 1 } > db.capped.stats() { "ns" : "tutorial.capped", "count" : 62815, "size" : 98996440, "avgObjSize" : 1576, "storageSize" : 100003840, "numExtents" : 1, "nindexes" : 1, "lastExtentSize" : 100003840, "paddingFactor" : 1, "systemFlags" : 1, "userFlags" : 0, "totalIndexSize" : 2044000, "indexSizes" : { "_id_" : 2044000 }, "capped" : true, "max" : 2147483647, "ok" : 1 }
Linux version: 3.4.11-1.fc16.x86_64
mongo version: db version v2.2.2, pdfile version 4.5
This is a dedicated computer that does nothing but start the Mongodb server and my test client. For this test, the car is ridiculously crushed.