adaptive sleep for ClientCusror::yield SERVER-975

This commit is contained in:
Eliot Horowitz
2010-04-06 13:49:51 -04:00
parent 0c9d1b4284
commit 009e2e4e0a
4 changed files with 24 additions and 0 deletions

View File

@@ -275,4 +275,21 @@ namespace mongo {
} handshakeCmd;
int Client::recommendedYieldMicros(){
int num = 0;
{
scoped_lock bl(clientsMutex);
num = clients.size();
}
if ( --num <= 0 ) // -- is for myself
return 0;
if ( num > 50 )
num = 50;
num *= 100;
return num;
}
}