Hello list,
I am analyzing a chunk migration performance problem of mongodb(v 2.4.6) sharding cluster.
After check the changelog of config db, i found there are some useful information that can help me to diagnose the longest time used in detail steps.
First i checked "moveChunk.from" and found below result:
"step1 of 6" : 0,
"step2 of 6" : 196,
"step3 of 6" : 18234,
"step4 of 6" : 1551243,
"step5 of 6" : 262,
"step6 of 6" : 0
}
It seems step4(F4:T1-T5) used lot of time, then i check the corresponding moveChunk.To and try to figure out which step in T1-T5 consume crazy time, here is the result:
"step1 of 5" : 2,
"step2 of 5" : 0,
"step3 of 5" : 1448987,
"step4 of 5" : 0,
"step5 of 5" : 741
It seems step3(T3) is the most time-consuming operation.
So i tried to understand what is "step3 of 5" (T3) exactly doing.
Could any one give a clue where can i find the accurate description on step3 of 5 and other "stepX on 6" and "stepY on 5" or provide a answer here?
I have also check the source code of mongodb's chunk migration and the corresponding code is as below
// 3. initial bulk clone
state = CLONE;
while ( true ) {
BSONObj res;
if ( ! conn->runCommand( "admin" , BSON( "_migrateClone" << 1 ) , res ) ) { // gets array of objects to copy, in disk order
state = FAIL;
conn.done();
return;
}
BSONObj arr = res["objects"].Obj();
int thisTime = 0;
BSONObjIterator i( arr );
while( i.more() ) {
BSONObj o = i.next().Obj();
{
PageFaultRetryableSection pgrs;
while ( 1 ) {
try {
Lock::DBWrite lk( ns );
Helpers::upsert( ns, o, true );
break;
}
catch ( PageFaultException& e ) {
e.touch();
}
}
}
thisTime++;
numCloned++;
clonedBytes += o.objsize();
if ( secondaryThrottle ) {
if ( ! waitForReplication( cc().getLastOp(), 2, 60 /* seconds to wait */ ) ) {
}
}
}
if ( thisTime == 0 )
break;
}
}
It seems T3 has three potential time-consuming processes
1) read data from F(rom) side (network I/O)
2) insert into T(o) side (disk I/O
3) deal with "secondaryThrottle" related process with the replica
So in my case, does ["step3 of 5" :1448987] means a lot of disk I/O (or poor I/O )? ( i did not monitoring the large network I/O and also i have set secondaryThrottle=false)
Thanks,
Joe