Module: workloads/secondary_reads.js

Test performance of secondary reads while applying oplogs

Setup

This workload should be run in a replica set of at least two nodes. The IP addresses of the primary and one of the secondaries are specified by the configuration.

Test

On an empty replica set, the workload performs the following actions:

  • Setup stage:
    • Inserted initial_nb_docs documents into both the primary and the secondaries. This should be done before any writes and reads.
  • Actual test stage:
    • nWriters background writers doing infinite writes on the primary which will replicate these writes to secondaries.
    • nReaders readers doing queries on a sepcified seconary. Each query has batch_size numbers of documents and only reads documents inserted in the setup stage in order to have more constant behavior all the time.

Read and write throughputs are reported as docs / sec. Read latencies on secondaries are reported as millis / ops. The workload also reports how delayed (millis) the secondary is from the primary when the workload finishes all the secondary reads.

Notes

  • Default test time is 3 minutes.
  • Default document size is 500 bytes.
  • Default number of documents in each vectored insert is 1.
  • Default number of initial documents is 10000.
  • For production setting, the number of writer threads should be fixed and a varying number of reader threads is used.

Owning-team

mongodb/replication

Source:

Members

(inner) batch_size

The number of documents for each vectored insert.

Source:

(inner) document_size

The size of each document in bytes.

Source:

(inner) initial_nb_docs

The number of preexisting documents. Note readers will only query these documents from the secondary.

Source:

(inner) prefix

The prefix to the name of the test.

Source:

(inner) primary

The primary IP address. The default is "10.2.0.100".

The value can be changed as a parameter, see this hello world example.

Source:

(inner) reader_threads

The number of threads to read from a specified secondary.

Source:

(inner) secondary

The secondary IP address. The default is "10.2.0.101".

The value can be changed as a parameter, see this hello world example.

Source:

(inner) test_duration_secs

The test duration in seconds per thread level.

Source:

(inner) writer_threads

The number of threads to write on primary.

Source: