MongoDB getmore on a collection is very slow -
i trying debug high cpu issue on mongodb instance. have 2 shard r3.large aws instances. there not many page faults compared ops count.
system profile shows ton of getmore entries below. please me in finding out causing getmore slow.
{ "op" : "getmore", "ns" : "mydb.mycollection", "cursorid" : 74493486271, "ntoreturn" : 0, "keyupdates" : 0, "numyield" : 7, "lockstats" : { "timelockedmicros" : { "r" : numberlong(16140), "w" : numberlong(0) }, "timeacquiringmicros" : { "r" : numberlong(6458801), "w" : numberlong(294321) } }, "nreturned" : 120, "responselength" : 13100, "millis" : 6304, "execstats" : { }, "ts" : isodate("2015-06-16t14:20:39.886z"), "client" : "1.5.1.3", "allusers" : [ ], "user" : "" }
answering own question may 1 else.
- enabled more logging when cpu high
db.admincommand( { setparameter: 1, loglevel: 1 } )
, after did reset loglevel: 0 (default). - then log showed aggregate query 0ms, right after that, getmore entry 5 6 secs.
aggregate query has
cursor: { batchsize: 0 }
initial batch size zero. so, query returns quickly. when application started iterating thru cursor, getmore logged , entry doesn't have query details.fixing aggregating query $match use indexes solved problem
Comments
Post a Comment