title: mongodb insert really slow
body: <p>i use mongodb to manage device log datas. Right now, it has over one million documents. the document contains more than 30 fields which combine with embed fields. Now, it's really slow when i insert new documents. The insert cost more than 1000ms. From the slow query ops, i get the logs like this:</p>
  
  <pre><code>{
      "op" : "insert",
      "ns" : "xxx.LogDeviceReport",
      "query" : {
          "_id" : ObjectId("xxxx"),
          "deviceId" : ObjectId("xxxx"),
          "en" : "xxxxxx",
          "status" : 1,
          'other fields, more than 30 fields...'
          ...
          ...
  
      },
      "ninserted" : 1,
      "keyUpdates" : 0,
      "writeConflicts" : 0,
      "numYield" : 0,
      "locks" : {
          "Global" : {
              "acquireCount" : {
                  "w" : NumberLong(2)
              }
          },
          "MMAPV1Journal" : {
              "acquireCount" : {
                  "w" : NumberLong(3)
              }
          },
          "Database" : {
              "acquireCount" : {
                  "w" : NumberLong(2)
              }
          },
          "Collection" : {
              "acquireCount" : {
                  "W" : NumberLong(1)
              },
              "acquireWaitCount" : {
                  "W" : NumberLong(1)
              },
              "timeAcquiringMicros" : {
                  "W" : NumberLong(1477481)
              }
          },
          "oplog" : {
              "acquireCount" : {
                  "w" : NumberLong(1)
              }
          }
      },
      "millis" : 977,
      "execStats" : {
  
      },
      "ts" : ISODate("2016-08-02T22:01:01.270Z"),
      "client" : "xxx.xxx.xxxx",
      "allUsers" : [
          {
              "user" : "xxx",
              "db" : "xxx"
          }
      ],
      "user" : "xx@xx"
  }
  </code></pre>
  
  <p>I checked the index, like this:</p>
  
  <pre><code>[
      {
          "v" : 1,
          "key" : {
              "_id" : 1
          },
          "name" : "_id_",
          "ns" : "xxx.LogDeviceReport"
      },
      {
          "v" : 1,
          "key" : {
              "time" : 1
          },
          "name" : "time_1",
          "ns" : "xxx.LogDeviceReport",
          "expireAfterSeconds" : 604800,
          "background" : true
      }
  ]
  </code></pre>
  
  <p>Only an _id index and a ttl index by time, no any other indexes. </p>
  
  <p>I guess the 'query' slow the operate. In mongodb doc, it tells that only the _id will be checked the unique, but in the logs, all fields in the 'query', does it matter?</p>
  
  <p>if not this reason, what makes it so slow? Can any one help me ? </p>