1

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月21日T08: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?

asked May 21, 2018 at 8:18
2
  • What is MongoDB version(x,y,z)? Commented May 21, 2018 at 8:36
  • The version is: 3.0.15 Commented May 21, 2018 at 8:37

2 Answers 2

0

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月19日T15: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月19日T15: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.

answered May 21, 2018 at 9:53
2
  • mongotop provides per-collection statistics on time spent reading and writing data. This is a measure of cumulative activity (time spent on read operations per collection) rather than throughput (number of read operations processed). mongostat would be more indicative of global system throughput. Commented May 21, 2018 at 23:23
  • @Stennie,The OP has run the command "mongotop" and also asked about the "read operation". Thanks for advice. Commented May 22, 2018 at 7:17
2

The mongostat tool provides you with this information.

Example output of mongostat:

insert query update delete getmore command dirty used flushes vsize res qrw arw net_in net_out conn set repl time
*0 2 *0 *0 0 2|0 0.0% 0.0% 0 3.18G 16.0M 0|0 1|0 556b 57.2k 2 replset PRI May 22 09:17:02.431

From the example above, the query field has the value of 2. This means that at that moment in time, the system processes two queries per second.

For full description of the output fields of mongostat, please see the Fields section.

answered May 21, 2018 at 23:20
1
  • So mongostat can give information about records returned per second? Commented May 22, 2018 at 9:49

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.