Stress Test

Mongo-perf

Mongo-perf (not to be confused with mongoperf) is a micro benchmarking tool for the MongoDB server. It measures throughput of commands with regards to the number of threads.

cd /home/hadoop/MongoDB

git clone https://github.com/mongodb/mongo-perf.git
cd mongo-perf
sudo apt install python-pip -y

pip install -r requirements.txt
python benchrun.py --help

usage: python benchrun.py -f <list of test files> -t <list of thread counts>
       run with --help for argument descriptions

mongo-perf micro-benchmark utility

optional arguments:
  -h, --help            show this help message and exit
  -f TESTFILES [TESTFILES ...], --testfiles TESTFILES [TESTFILES ...]
                        Provide a list of js test files to run
  -t THREADS [THREADS ...], --threads THREADS [THREADS ...]
                        Specify which thread configuration to use
  -m MULTIDB, --multidb MULTIDB
                        Specify how many databases the test should use
  -c MULTICOLL, --multicoll MULTICOLL
                        Specify how many collections the test should use
  --trialTime SECONDS   Specify how many seconds to run each trial
  --trialCount TRIALS   Specify how many trials to run
  --host HOSTNAME       hostname of the mongod/mongos under test
  --port PORT           Port of the mongod/mongos under test
  --replset REPLICA_SET
                        replica set name of the mongod/mongos under test
  -u USERNAME, --username USERNAME
                        username to use for mongodb authentication
  -p PASSWORD, --password PASSWORD
                        password to use for mongodb authentication
  --shard {0,1,2}       Specify shard cluster the test should use, 0 - no shard, 1 - shard with {_id: hashed}, 2 - shard with {_id: 1}
  -s SHELLPATH, --shell SHELLPATH
                        Path to the mongo shell executable to use.
  --safe [{true,false}]
                        this option enables a call to GLE after every op instead of every 100 ops
  -w W                  w write concern
  -j [{true,false}]     this option turns on the j write concern
  --writeCmd [{true,false}]
                        this option turns on use of the write commands instead of legacy write operations
  --readCmd [{true,false}]
                        this option turns on use of the read commands instead of legacy read operations
  --includeFilter INCLUDEFILTER [INCLUDEFILTER ...]
                        Run just the specified tests/suites. Can specify multiple tags per --includeFilter
                        flag. All tests/suites matching any of the tags will be run.
                        Can specify multiple --includeFilter flags on the command line. A test
                        must match all the --includeFilter clauses in order to be run.

                        Ex 1: --includeFilter insert remove  --includeFilter core
                               will run all tests tagged with ("insert" OR "remove") AND ("core").
                        Ex 2: --includeFilter %
                               will run all tests
  --excludeFilter EXCLUDEFILTER [EXCLUDEFILTER ...]
                        Exclude tests matching all of the tags included.
                        Can specify multiple --excludeFilter flags on the command line. A test
                        matching any --excludeFilter clauses will not be run.
                        A test that is both included according to --includeFilter and excluded by --excludeFilter,
                        will not be run.

                        Ex: --excludeFilter slow old --excludeFilter broken
                             will exclude all tests tagged with ("slow" AND "old") OR ("broken").
  --out OUTFILE         write the results as json to the specified file
  --exclude-testbed [{true,false}]
                        Exclude testbed information from results file
  --printArgs [{true,false}]
                        Print the benchrun args before running the test.

Run

python benchrun.py -f <list of testfiles> -t <list of thread configs> [-m <number of dbs>] [-s <shell path>]
  • To run the simple_insert.js test case on 1, 2, and 4 threads, no multi-db and using the basic mongo shell
python benchrun.py -f testcases/simple_insert.js -t 1 2 4
MongoDB shell version v3.6.5
connecting to: mongodb://localhost:27017/
MongoDB server version: 3.6.5
db version: 3.6.5
a20ecd3e3a174162052ff99913bc2ca9a839d618

load('util/utils.js')

load('testcases/simple_insert.js')

mongoPerfRunTests([1, 2, 4], 1, 1, 5, 1, "%", [], 0, {"writeCmdMode": "true", "safeGLE": "false", "readCmdMode": "false", "writeConcern": {"j": "false"}}, false, false);

Insert.Empty
1       11462.071099176464
2       20737.548706376627
4       32616.348563755517
Insert.EmptyCapped
1       8733.381787710658
2       15544.463815696148
4       11472.401702780197
Insert.EmptyCapped.SeqIntID
1       9283.605420283886
2       14111.73450581644
4       13577.004409475117
Insert.JustID
1       11385.097965214833
2       18406.93042008479
4       26504.64831208018
Insert.IntVector
1       1896.3973048292773
2       3199.482682732579
4       4814.945315564676
Insert.SeqIntID.Indexed
1       10758.972472956659
2       19650.600471102734
4       23475.1857210267
Insert.IntIDUpsert
1       8161.39534074875
2       15090.060648072082
4       26524.51246657082
Insert.JustNum
1       11132.537518198455
2       21169.421294437325
4       26854.75698795489
Insert.JustNumIndexed
1       10112.42603077184
2       19515.043074725083
4       24604.11212980969
InsertIndexedStringsSimpleCollation
1       9854.659611186376
2       18756.476435369972
4       23685.36930172194
InsertIndexedStringsNonSimpleCollation
1       9193.75192619096
2       17064.34164179033
4       21874.743437646885
Insert.UniqueIndex
1       10553.5607749631
2       19576.896803542728
4       27371.53307003893
Insert.UniqueIndexCompound
1       10223.361171856573
2       17808.031957109186
4       23910.12889108458
Insert.UniqueIndexCompoundReverse
1       9641.280480065087
2       17926.78483961239
4       26576.290398877176
Insert.LargeDocVector
1       916.0604928290721
2       1437.4951143615044
4       1892.629394274681
Finished Testing.
{
    "errors": [
        0
    ],
    "end": "2018-05-31T07:43:46.940Z",
    "results": [
        {
            "name": "Insert.Empty",
            "results": {
                "1": {
                    "ops_per_sec": 11462.071099176464,
                    "ops_per_sec_values": [
                        11462.071099176464
                    ],
                    "error_values": [
                        0
                    ]
                },
                "start": "2018-05-31T07:39:59.207Z",
                "2": {
                    "ops_per_sec": 20737.548706376627,
                    "ops_per_sec_values": [
                        20737.548706376627
                    ],
                    "error_values": [
                        0
                    ]
                },
                "end": "2018-05-31T07:40:14.302Z",
                "4": {
                    "ops_per_sec": 32616.348563755517,
                    "ops_per_sec_values": [
                        32616.348563755517
                    ],
                    "error_values": [
                        0
                    ]
                }
            }
        },
...
...
...
        {
            "name": "Insert.LargeDocVector",
            "results": {
                "1": {
                    "ops_per_sec": 916.0604928290721,
                    "ops_per_sec_values": [
                        916.0604928290721
                    ],
                    "error_values": [
                        0
                    ]
                },
                "start": "2018-05-31T07:43:30.582Z",
                "2": {
                    "ops_per_sec": 1437.4951143615044,
                    "ops_per_sec_values": [
                        1437.4951143615044
                    ],
                    "error_values": [
                        0
                    ]
                },
                "end": "2018-05-31T07:43:46.940Z",
                "4": {
                    "ops_per_sec": 1892.629394274681,
                    "ops_per_sec_values": [
                        1892.629394274681
                    ],
                    "error_values": [
                        0
                    ]
                }
            }
        }
    ],
    "start": "2018-05-31T07:39:59.206Z",
    "storageEngine": "wiredTiger",
    "basicFields": {
        "crudOptions": {
            "writeCmdMode": "true",
            "safeGLE": "false",
            "readCmdMode": "false",
            "writeConcern": {
                "j": false
            }
        },
        "commit": "a20ecd3e3a174162052ff99913bc2ca9a839d618",
        "version": "3.6.5",
        "platform": "deprecated"
    }
}

results matching ""

    No results matching ""