[SERVER-10894] Mongostat delay with summarization Created: 25/Sep/13  Updated: 22/Aug/14  Resolved: 22/Aug/14

Status: Closed
Project: Core Server
Component/s: Tools
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Kevin J. Rice Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

Mongostat currently runs once per second by default, this can be changed by specifying a sleep interval.

With large numbers of shards and replicas, this can be a lot of data to transmit once per second. it would be nice to be able to alter this to a 5-second interval.

BUT: this is NOT a sleep concept:

  • Counts for insert/query/update/delete/getmore/command/flushes and network in/out should be accumulated (SUMMED);
  • Counts for the rest: mapped/vsize/res/locked/miss%/qr/qw/ar/aw should be AVERAGED.

Or, all could be both averaged and summed , with additional columns for avg/sum of each. Knowing the number of inserts/second would be nice, but averaged over 5 seconds vs. total number in the last 5 seconds - these are useful datapoints.



 Comments   
Comment by Thomas Rueckstiess [ 22/Aug/14 ]

Hi Kevin,

mongostat does average the results per second, this is described on the mongostat documentation page. I've done a quick test and confirm that this works as described:

This script inserts a burst of 1000 documents, then sleeps for 10 seconds.

while (true) {
    for (var i = 0; i < 1000; i++) {
        db.docs.insert( {foo: i} );
    }
    print('insert 1000 docs');
    sleep(10000);
}

Running mongostat 10 outputs this:

insert  query update delete getmore command  vsize    res faults  netIn netOut  conn repl       time
   100      0      0      0       0     100  2.38g     6m      0    12k     5k     2  RTR   15:20:23
   100      0      0      0       0     100  2.38g     6m      0    12k     5k     2  RTR   15:20:33
   100      0      0      0       0     100  2.38g     6m      0    12k     5k     2  RTR   15:20:43
...

If mongostat really considered only the last second, we'd see 0 inserts or 1000 inserts, but it's averaging over the full 10 seconds, returning 100 docs/sec on average.

Given that the stats are indeed averaged, I believe duplicating every column to additionally output the total numbers (n * <sleepdelay>) is not very helpful. The rows would get really wide and the impact on readability outweighs the added benefit.

Thanks,
Thomas

Comment by Kevin J. Rice [ 03/Apr/14 ]

In testing with 2.6.0 RC3, It looks like invoking it on a sharded replicated database with:

mongostat --discover --host myhost --port 9999 5

This makes it print every 5 seconds, and this is good. But, it looks like it's not averaging the results over the last 5 seconds, it's just sleeping for 4 seconds and running again. Am I correct? The numbers seem to fluctuate widely even every 5 seconds, which should not reflect my workload. Of course, I could be wrong - am I ?

Generated at Thu Feb 08 03:24:20 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.