I wrote a script to copy system.profile collections from every mongod
into one globally accessible profiling collection. I added to each
document its mongod connection point to know on which node run the
query.
It turns out that I get more and more of these 14 days queries. Here
are the top 5:
mongos>
db.profiling.find().sort({millis:-1}).limit(5).forEach(printjson)
{
"_id" : ObjectId("4f844705559a774c0f1f1700"),
"ts" : "2012-04-10T14:10:09Z",
"op" : "query",
"ns" : "offerStore.offer",
"query" : {
"_id" : 858680314
},
"idhack" : true,
"responseLength" : 1393,
"millis" : 1271309469,
"client" : "#.#.#.#",
"user" : "",
"mongod" : "s132.ipx:27018"
}
{
"_id" : ObjectId("4f8446fc559a774c0f1f0693"),
"ts" : "2012-04-05T14:24:59Z",
"op" : "getmore",
"ns" : "offerStore.offer",
"query" : {
"missingSince" : null,
"shopId" : 5040
},
"cursorid" : NumberLong("1817499255547817100"),
"nreturned" : 68132,
"responseLength" : 3883544,
"millis" : 1271309097,
"client" : "#.#.#.#",
"user" : "",
"mongod" : "s143.ipx:27018"
}
{
"_id" : ObjectId("4f8446fa559a774c0f1f053d"),
"ts" : "2012-04-08T02:08:08Z",
"op" : "query",
"ns" : "offerStore.offer",
"query" : {
"missingSince" : null,
"categoryBokey" : "212795:StGQqkQ8AV45NElQbaFNfw"
},
"responseLength" : 20,
"millis" : 1271308447,
"client" : "#.#.#.#",
"user" : "",
"mongod" : "s126.ipx:27018"
}
{
"_id" : ObjectId("4f8446fb559a774c0f1f0644"),
"ts" : "2012-04-09T02:08:03Z",
"op" : "query",
"ns" : "offerStore.offer",
"query" : {
"missingSince" : null,
"categoryBokey" : "207283:07ofhAIn/kJWFuKDIlQYXQ"
},
"nscanned" : 8,
"nreturned" : 8,
"responseLength" : 514,
"millis" : 1271303702,
"client" : "#.#.#.#",
"user" : "",
"mongod" : "s131.ipx:27018"
}
{
"_id" : ObjectId("4f844701559a774c0f1f10d7"),
"ts" : "2012-04-08T02:04:02Z",
"op" : "getmore",
"ns" : "offerStore.offer",
"query" : {
"shopId" : 22307
},
"cursorid" : NumberLong("7522793855964665641"),
"nreturned" : 35053,
"responseLength" : 2303689,
"millis" : 1271303044,
"client" : "#.#.#.#",
"user" : "",
"mongod" : "s115.ipx:27018"
}
I verified in the system.profile collection of the concerned mongod if
the slow query really existed or if my script copied something wrong.
It seems that it really exists:
connecting to: s132:27018/offerStore
SECONDARY> rs.slaveOk()
SECONDARY> db.system.profile.findOne({"query._id":858680314})
{
"ts" : ISODate("2012-04-10T12:10:09.218Z"),
"op" : "query",
"ns" : "offerStore.offer",
"query" : {
"_id" : NumberLong(858680314)
},
"idhack" : true,
"responseLength" : 1393,
"millis" : 1271309469,
"client" : "#.#.#.#",
"user" : ""
}
As you can see, the timestamp is of today even though the shard run
well today.
Btw. is the timestamp the start or the end of the query?