Module: workloads/secondary_performance

This workload is designed to capture replication throughput and provide a comparison to the primary throughput. It is solely converned with the pace of replication of a secondary process. As a result, it specifically uses a 2 node PS (1 Primary, 1 Secondary) replica set configuration.

Test

On an empty 2 node PS replica set, this workload performs the following actions:

  • Pause replication.
  • Insert a fixed number of documents (on the primary only as replication is paused).
  • Note the duration required to insert all the documents (in seconds) as the primary duration.
  • Perform a blocking write in a separate thread.
  • Unpause replication.
  • Wait for the blocking write thread to complete.
  • Note the duration of the blocking write as the secondary duration (in seconds).

Results are the primary and secondary throughputs. They are calculated from count / duration docs per second.

Setup

The starting point for this test is a 2 node replica set:

  • one primary
  • one secondary.

To begin the test:

  • a single document is inserted to ensure the collection exists on all processes.
  • all the replica set members are quiesced.
  • replication is stopped on the secondary.

The fsync command is used to flush all writes on the primary.

An insertion workload is written to the primary using each of the thread_levels as the num insert threads. Each thread inserts a total of count / num insert threads documents in a UnorderedBulkOp of up to a max of 1000 documents per batch.

The documents consists of:

  • _id: an ObjectId
  • s: a string of of length size + 1 (size varies from 1 to 10000)

Next a write is performed with a write concern of { w: all } is performed in a separate thread. Replication is resumed and the duration of the write thread is timed.

Notes

Currently, the externally supplied thread_levels are [32] for wiredTiger and [10] for MMAPv1. For each thread level as num insert threads:

  • Insert count documents using num insert threads threads.
  • Each document contains the following fields:
    • _id: an ObjectId
    • s: a string of size + 1 bytes
  • Roughly speaking each document will be 30 + size + 1 bytes in length.
  • The value of 30 comes from the result of the following javascript ~Object.bsonsize({_id:ObjectId() , s:''})~

Owning-team

mongodb/replication

Source:

Members

(inner) count

The total number of documents to insert. One of 10M and 1M (1M is for size 10000). The default is 10M.

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

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) 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) size

The size of string to use. It can be any value (less than ~16GB). The external configutation currently uses 1, 100, 1000 and 10000. The default is 1.

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

Source:

(inner) thread_levels

The number of threads used to insert documents. The default is [32].

Note: this value is only used as the number of threads to insert data. Unlike in other tests, it is not specifically configuring a measurable metric for this test. As a result, only a single value is expected.

The actual values in use are injected by run_workloads.py, which gets it from config file, see this hello world example.

Source: