2

By looking at MongoDB MMS charts, is there a way to calculate a database read/write ratio, or roughly determine whether a database is read-heavy or write-heavy?

Assume I do not have contact with developer and therefore has no idea on database's schema or use case.

Edit: I understand MMS metrics are based on entire databases on the single mongod instance. However, assume currently there is only one database exist.

Example MMS chart: mms_chart

asked Aug 29, 2014 at 15:28
1
  • are you mainly asking about a single node (primary of replica set) or about a sharded cluster? Commented Aug 30, 2014 at 15:34

2 Answers 2

1

MMS charts have multiple quantities you can add to determine the number of reads and the number of writes - at a glance they are:

  • Reads:

    • queries
    • getmores
  • Writes:

    • inserts
    • updates
    • deletes/removes

As a general ballpark value, the ratio of these is fine.

It's not quite this simple though because there are other read and write "loads" on the system:

  • system writes which don't show up in counters, such as TTL deletes, etc.
  • commands which may be reads: count, aggregate, in 2.4 and earlier getLastError().
  • commands which may be writes: findAndModify, etc.
  • on a primary a multi-update or remove that matches multiple documents is recorded as a single write operation (on secondary it would be a single write per document affected)
  • a single read operation (aka find) may be a fast, indexed query or a slow collection scan of millions of documents.

Hope this helps, as in general you usually care about not exact absolute ratio of reads to writes, but rather how that ratio may be changing over time.

answered Sep 1, 2014 at 19:56
2

There are two way.

opcounters

Build as sum of the opcounters which are write operations, build a sum of the opcounters which are read operations set them into relation. To do this reliably for a sharded cluster, you have to create a dashboard which groups the opcounters for the shards.

network in/out ratio

This is self explanatory. But please keep in mind that you have to divide the out ratio by the number of replica set members to get a rough idea. For a sharded cluster, you need this grouped by shards in a dashboard, too.

What really comes to my mind: you should actually know if you have a rather read or rather write heavy application. Your use case, your business model (if applicable), your implementation, your integration tests: all these should give you an idea.

answered Aug 31, 2014 at 9:32

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.