Note that there are some explanatory texts on larger screens.

plurals
  1. POCapped Collection Performance Issues
    primarykey
    data
    text
    <p>I'm doing some tests to see what kind of throughput I can get from Mongodb. The documentation says that capped collections are the fastest option. But I often find that I can write to a normal collection much faster. Depending on the exact test, I can often get twice the throughput with a normal collection.</p> <p>Am I missing something? How do I troubleshoot this?</p> <p>I have a very simple C++ program that writes about 64,000 documents to a collection as fast as possible. I record the total time, and the time that I'm waiting for the database. If I change nothing but the collection name, I can see a clear difference between the capped and normal collections.</p> <pre><code>&gt; use tutorial switched to db tutorial &gt; 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 } } &gt; 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 } &gt; 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 } </code></pre> <p>linux version: 3.4.11-1.fc16.x86_64</p> <p>mongo version: db version v2.2.2, pdfile version 4.5</p> <p>This is a dedicated machine doing nothing but running the Mongodb server and my test client. The machine is ridiculously overpowered for this test. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    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.
 

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