Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Interpreting Mongostat and Mongotop output

I'm doing some profiling on mongodb using mongostat and mongotop

I run mongotop:

$> mongotop 30

and mongostat simply:

$> mongostat

The outputs are:

Mongotop:

                    ns       total        read       write      2012-11-23T01:32:37
           sapi.Socket      1222ms      1222ms         0ms
       sapi.ChargeSpot       999ms       999ms         0ms

Mongostat:

insert  query update delete getmore command flushes mapped  vsize    res faults          locked db idx miss %     qr|qw   ar|aw  netIn netOut  conn     set repl       time 
     0   5351      0      0       0       1       0   608m  3.67g    64m      0          sapi:0.0%          0       0|0     1|0   569k     1m    63 capi-rs  PRI   12:32:41 
     0   4189      0      0       0       1       0   608m  3.67g    64m      0 knightsbridge:0.0%          0       0|0     0|0   499k   308k    63 capi-rs  PRI   12:32:42 

Questions:

  • For the mongotop output, since I ran it to report on 30 second intervals, does e.g. sapi.Socket total of 1222ms reads mean that:

    in the 30 second interval, 1222ms is spent executing read queries from the collection sapi.Socket

    Which would mean that in the 30 seconds, mongo was only busy for 2,221ms (1,222ms + 999ms) handling read queries, in other words, mongo was idle for the other 27 seconds?

  • For mongostat output, It looks like mongo is handling around 5K queries per second, is this pushing mongo a bit or is mongo capable of much more? the queries are basic (lookup up by indexed key)
like image 328
Dzhu Avatar asked Nov 04 '22 10:11

Dzhu


1 Answers

All of the operations per second metrics are going to be a relative metric per your particular server's config and the cluster architecture. You are not pushing Mongo with 5k queries however.

A complimentary tool to use is the DB profiler. The profiler will capture all ops in this case to a system collection named system.profile. You can then gleam some more insights into individual queries and how they are performing.

//example of diagnostics for just query operations, not inserts or deletes or commands, against a //DB named dfl and a collection named test.

db.system.profile.find({op: {$eq : 'query'}, ns: 'dfl.test'})

//check your profiler status db.getProfilingStatus()

//set the profiler to all operations db.setProfilingLevel(2)

like image 126
SDillon Avatar answered Nov 09 '22 12:11

SDillon