Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-8024

getLastError >90 ms delay over mongos

    • Type: Icon: Bug Bug
    • Resolution: Incomplete
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.0.6, 2.2.0, 2.2.2
    • Component/s: Sharding
    • Environment:
      FreeBSD 8.2 / 9.0 / 9.1 PRERELEASE
    • FreeBSD
    • Hide

      Simple php script:

      <?php
      // connecting to mongos
      $m = new MongoClient('mongodb://127.0.0.1:20027');
      $db = $m->selectDB('test');

      $collection = new MongoCollection($db, 'c1');

      $mt = microtime(true);
      $r = $collection->insert(array('n' => 1));
      echo round( (microtime(true) - $mt) * 1000), "\n";

      Show
      Simple php script: <?php // connecting to mongos $m = new MongoClient('mongodb://127.0.0.1:20027'); $db = $m->selectDB('test'); $collection = new MongoCollection($db, 'c1'); $mt = microtime(true); $r = $collection->insert(array('n' => 1)); echo round( (microtime(true) - $mt) * 1000), "\n";

      I'am trying to deploy shard cluster for tests.
      Using docs http://docs.mongodb.org/manual/tutorial/deploy-shard-cluster/

      And every time when execute update there is strange delay 90+ ms.

      mongos.log:

      Sun Dec 23 23:41:06 [conn1] Request::process begin ns: test.$cmd msg id: 2 op: 2004 attempt: 0
      Sun Dec 23 23:41:06 [conn1] single query: test.$cmd

      { getlasterror: 1 }

      ntoreturn: -1 options : 0 0ms
      Sun Dec 23 23:41:06 [conn1] gathering response for gle from: 127.0.0.1:20001
      Sun Dec 23 23:41:06 [conn1] T1: 0ms
      Sun Dec 23 23:41:06 [conn1] T2: 99ms
      Sun Dec 23 23:41:06 [conn1] gathering writebacks from 3 hosts for gle (127.0.0.1:20001)
      Sun Dec 23 23:41:06 [conn1] gathering writebacks for single-shard gle from: 127.0.0.1:20002
      Sun Dec 23 23:41:06 [conn1] gathering writebacks for single-shard gle from: 127.0.0.1:20003
      Sun Dec 23 23:41:06 [conn1] checking 0 writebacks for gle (127.0.0.1:20001)
      Sun Dec 23 23:41:06 [conn1] Request::process end ns: test.$cmd msg id: 2 op: 2004 attempt: 0 99ms

      I add some debug information into: src/mongo/s/client_info.cpp (function ClientInfo::getLastError):

      Timer t;
      LOG(5) << "gathering response for gle from: " << theShard << endl;

      ShardConnection conn( theShard , "" );
      try

      { LOG(5) << "T1: " << t.millis() << "ms" << endl; ok = conn->runCommand( dbName , options , res ); LOG(5) << "T2: " << t.millis() << "ms" << endl; }

            Assignee:
            ramon.fernandez@mongodb.com Ramon Fernandez Marina
            Reporter:
            belov Konstantin Belov
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: