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?
-
What is MongoDB version(x,y,z)?Md Haidar Ali Khan– Md Haidar Ali Khan2018年05月21日 08:36:57 +00:00Commented May 21, 2018 at 8:36
-
The version is: 3.0.15e7lT2P– e7lT2P2018年05月21日 08:37:52 +00:00Commented May 21, 2018 at 8:37
2 Answers 2
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.
-
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.Stennie– Stennie2018年05月21日 23:23:14 +00:00Commented May 21, 2018 at 23:23 -
@Stennie,The OP has run the command "mongotop" and also asked about the "read operation". Thanks for advice.Md Haidar Ali Khan– Md Haidar Ali Khan2018年05月22日 07:17:33 +00:00Commented May 22, 2018 at 7:17
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.
-
So mongostat can give information about records returned per second?e7lT2P– e7lT2P2018年05月22日 09:49:45 +00:00Commented May 22, 2018 at 9:49