-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: 2.8.0-rc3
-
Component/s: None
-
None
-
Fully Compatible
-
ALL
-
I ran iibench (https://github.com/tmcallaghan/iibench-mysql) changed to insert 1 document per write and fsync enabled. My storage is fast (PCIe flash). With 10 threads I get more than 10,000 docs inserted per second. When I change to 1 thread I get ~20 docs inserted per second (or 1 per 50 milliseconds).
So then I start to look at WiredTiger source for a 50 millisecond sleep and find this in db/storage/wiredtiger/wiredtiger_recovery_unit.cpp
// return true if happened bool awaitCommit() { boost::mutex::scoped_lock lk( mutex ); long long start = lastSyncTime; numWaitingForSync.fetchAndAdd(1); condvar.timed_wait(lk,boost::posix_time::milliseconds(50)); numWaitingForSync.fetchAndAdd(-1); return lastSyncTime > start; }
A typical thread stack during the single threaded test is:
pthread_cond_timedwait@@GLIBC_2.3.2,timed_wait<boost::unique_lock<boost::mutex>,timed_wait<boost::unique_lock<boost::mutex>,,awaitCommit,mongo::WiredTigerRecoveryUnit::awaitCommit,mongo::waitForWriteConcern,mongo::CmdGetLastError::run,mongo::_execCommand,mongo::Command::execCommand,mongo::_runCommands,runCommands,mongo::runQuery,receivedQuery,mongo::assembleResponse,mongo::MyMessageHandler::process,mongo::PortMessageServer::handleIncomingMsg