MongoDB Throughput – How to Measure Throughput in MongoDB

mongodb

I want to measure the throughput of read operations in Mongo. By throughput I mean "how many reads the system process in a given amount of time (every second)".

I run mongotop 1 and I get:

                 ns       total    read    write    2018-05-21T08:01:25Z

 sampledb.samplecol        57ms    25ms     32ms        

local.replset.minvalid     28ms     0ms     28ms  

     local.oplog.rs         9ms     9ms      0ms 

admin.system.indexes        0ms     0ms      0ms  

admin.system.namespaces     0ms     0ms      0ms  

 admin.system.roles         0ms     0ms      0ms   

 admin.system.users         0ms     0ms      0ms    

admin.system.version        0ms     0ms      0ms   

           local.me         0ms     0ms      0ms   

  local.startup_log         0ms     0ms      0ms          

Is this means that the throughput of read operations is 25ms?

Best Answer

As per MongoDB documentation here The mongotop provides a method to track the amount of time a MongoDB instance spends reading and writing data. mongotop provides statistics on a per-collection level. By default, mongotop returns values every second.

Run mongotop from the system command line, not the mongo shell.

By default mongotop connects to the MongoDB instance running on the localhost port 27017. However, mongotop can optionally connect to remote mongod instances.

For Example to force mongotop to return less frequently specify a number, in seconds at the end of the command. In this example, mongotop will return every 15 seconds.

mongotop 15

This command produces the following output:

ns    total    read    write          2014-12-19T15:32:01-05:00
     admin.system.roles      0ms     0ms      0ms
   admin.system.version      0ms     0ms      0ms
               local.me      0ms     0ms      0ms
         local.oplog.rs      0ms     0ms      0ms
 local.replset.minvalid      0ms     0ms      0ms
      local.startup_log      0ms     0ms      0ms
   local.system.indexes      0ms     0ms      0ms
local.system.namespaces      0ms     0ms      0ms
   local.system.replset      0ms     0ms      0ms

                     ns    total    read    write          2014-12-19T15:32:16-05:00
     admin.system.roles      0ms     0ms      0ms
   admin.system.version      0ms     0ms      0ms
               local.me      0ms     0ms      0ms
         local.oplog.rs      0ms     0ms      0ms
 local.replset.minvalid      0ms     0ms      0ms
      local.startup_log      0ms     0ms      0ms
   local.system.indexes      0ms     0ms      0ms
local.system.namespaces      0ms     0ms      0ms
   local.system.replset      0ms     0ms      0ms

The output varies depending on your MongoDB setup.

mongotop.read

Provides the amount of time that this mongod spent performing read operations on this namespace.

mongotop.write

Provides the amount of time that this mongod spent performing write operations on this namespace.

Is this means that the throughput of read operations is 25ms

Yes, In your case provides the amount of time that this mongod spent performing read operations on this namespace.