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

Mongostat opcount varies with sleep time when polling multiple hosts

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 2.0.2
    • Fix Version/s: 2.3.2
    • Component/s: Tools
    • Labels:
    • Operating System:
      ALL

      Description

      When mongostat is run with multiple hosts (either with the --discover flag or -h), the number of operations appears to be divided by the sleep time.

      To reproduce:

      Here is a JS function that will insert 100 records per second for a minute:

      > for(var i=0; i<60; i++){for(var j = 0; j<100; j++){db.stattest.save({t:i, x:j})};sleep(1000);}

      While the above is running, run mongostat with the following options:

      $ bin/mongostat -h localhost,127.0.0.1 5
      insert query update delete getmore command flushes mapped vsize res locked % idx miss % qr|qw ar|aw netIn netOut conn time
      127.0.0.1:27017 20 0 0 0 0 1 0 464m 3.35g 9m 0.1 0 0|0 0|0 1k 1k 8 11:56:23
      localhost 20 0 0 0 0 1 0 464m 3.35g 9m 0.1 0 0|0 0|0 1k 1k 8 11:56:23

      Notice that the number of inserts is 20 (100/5). The same can be observed with using --discover:

      $ bin/mongostat --discover 5
      insert query update delete getmore command flushes mapped vsize res locked % idx miss % qr|qw ar|aw netIn netOut conn time
      localhost:27017 20 0 0 0 0 1 0 464m 3.35g 8m 0.2 0 0|0 0|0 1k 1k 8 11:56:45

      If an interval of 10seconds is used, the "inserts" count changes to 10 (100/10):
      $ bin/mongostat --discover 10
      connected to: 127.0.0.1

      insert query update delete getmore command flushes mapped vsize res locked % idx miss % qr|qw ar|aw netIn netOut conn time
      localhost:27017 10 0 0 0 0 0 0 464m 3.35g 5m 0.3 0 0|0 0|0 817b 787b 8 11:54:24

      The work-around is to poll only one host at a time, or poll multiple hosts with no delay. (In the second case, the division will still occur, but it will be by 1.)

        Attachments

          Activity

            People

            • Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: