tencent cloud

Feedback

Test Method

Last updated: 2024-10-10 10:41:34
    This document introduces the complete process of using YCSB to conduct performance testing on TencentDB for MongoDB.

    Test Objectives

    Note:
    Due to MongoDB’s flexible data structure and complex, variable use cases, it’s difficult to cover all scenes. Final performance should be tested according to the actual business model.
    Performance testing is conducted on different MongoDB instance specifications, including 2 cores 4 GB, 4 cores 8 GB, 6 cores 16 GB, and others. The main performance metrics tested include throughput (ops/sec), RAL (us) average read latency, and WAL (us) average write latency.
    The test scenes for each instance specification are as follows:
    50% read + 50% update: The read-to-update ratio is 50% to 50%.
    95% read + 5% update: The read-to-update ratio is 95% to 5%.
    5% read + 95% update: The read-to-update ratio is 5% to 95%.
    100% insert: Data is only written.
    100% read: Data is only read.
    100% update: Data is only updated.

    Testing Steps

    Step 1: Remotely Connecting to CVM Instance and Downloading the YCSB Tool

    1. Log in to the CVM instance using the standard login method. For detailed instructions, see log in to server.
    2. Download YCSB on the CVM instance.

    Step 2: Loading Baseline Test Data into the MongoDB Database

    Use the nohup command to run the YCSB tool in the background. Use the configuration file workloada to connect to the specified MongoDB cluster and load data into the test collection in synchronous mode, with output recorded in the loadlog.txt file. The specific parameters are explained as follows.
    Command Breakdown
    Explanation
    nohup
    A Linux command used to run long-running background processes, ensuring that these processes are not interrupted by user logouts or terminal closures.
    ./ycsb-0.17.0/bin/ycsb
    The path to the YCSB executable file.
    load
    A YCSB subcommand used to load data into the database.
    mongodb
    Specifies the database type to load, in this case, MongoDB.
    -s
    Specifies synchronous mode, meaning the load operation will only return after all operations are completed.
    -P workloads/workloada
    Specifies the YCSB workload configuration file to use, in this case, workloada.
    -p mongodb.url=mongodb://mongouser:password@10.xx.xx.30:27017,10.xx.xx.28:27017,10.xx.xx.5:27017/admin?w=0
    Specifies the MongoDB connection URL.
    The connection string includes the username, password, server addresses, and port numbers.
    w=0 means that write operations do not require acknowledgment, meaning no response is awaited for the write operation.
    -p table=test
    Specifies the collection name used in MongoDB, in this case, test.
    -threads 300
    Specifies the number of threads to use for executing the load operation, which is 300 in this example. The number of threads used for testing varies based on the instance specification. For more details, see Test Results.
    -p recordcount=10000000
    Specifies the total number of records to load, which is 10 million records in this example. The total number of records used for testing varies based on the instance specification. For more details, see Test Results.
    >loadlog.txt &
    Redirects the command output to the loadlog.txt file and uses & to run the command in the background.
    nohup ./ycsb-0.17.0/bin/ycsb load mongodb -s -P workloads/workloada
    -p mongodb.url=mongodb://mongouser:password@10.xx.xx.30:27017,10.xx.xx.28:27017,10.xx.xx.5:27017/admin?w=0 -p table=test -threads 300 -p recordcount=10000000>loadlog.txt &

    Step 3: Running the Script for Stress Testing

    50% update + 50% read

    Execute a total of 10,000,000 operations, where 50% are read operations and 50% are update operations, with no insert operations performed. The operations are executed in parallel using 100 threads, and the output is recorded in the runlog.txt file. Key configuration parameters are as follows:
    -p table=test:: Specifies the collection name used in MongoDB.
    -p recordcount=10000000: Specifies the total number of records in the database.
    -p readproportion=0.5:: Specifies the proportion of read operations, which is 50%.
    -p updateproportion=0.5: Specifies the proportion of update operations, which is 50%.
    -p insertproportion=0:: Specifies the proportion of insert operations, which is 0%, meaning no insert operations are performed.
    -p operationcount=100000: Specifies the total number of operations to execute.
    -threads 100: Specifies the number of threads to use for executing the operations.
    >runlog.txt &: Redirects the command output to the runlog.txt file and uses & to run the command in the background.
    Note:
    The values for recordcount, operationcount, and threads vary for different instance specifications. For specific data, see Test Results.
    The -p operationcount=100000 parameter should be adjusted dynamically based on the actual execution time, ensuring that the test runs for more than 20 minutes. Test result by a shorter execution time may not be representative.
    The w in ?w=0 refers to the write concern. In MongoDB, the write concern level is set to 0, meaning the write operation does not wait for acknowledgment from the server.
    w:1 (acknowledged write) requires confirmation that the operation has propagated to the specified single mongod instance or the primary instance of the replica set. The default value is 1.
    w:0 (unacknowledged write) does not confirm if the write was successful. However, it returns an error if it attempts to write to a closed socket or encounters network issues.
    w:>1 specifies the number of nodes, including the primary nodes, that need to acknowledge the write.
    nohup ./ycsb-0.17.0/bin/ycsb run mongodb -s -P workloads/workloada -p mongodb.url=mongodb://mongouser: password @10.xx.xx.30:27017,10.xx.xx.28:27017,10.xx.xx.5:27017/admin?w=0 -p table=test -p recordcount=10000000 -p readproportion=0.5 -p updateproportion=0.5 -p insertproportion=0 -p operationcount=10000000 -threads 100 >runlog.txt &

    95% Update + 5% Read

    Execute a total of 10,000,000 operations, where 95% are update operations and 5% are read operations, with no insert operations performed. The operations are executed in parallel using 100 threads, and the output is recorded in the runlog.txt file.
    nohup ./ycsb-0.17.0/bin/ycsb run mongodb -s -P workloads/workloada -p mongodb.url=mongodb://mongouser: password @10.xx.xx.30:27017,10.xx.xx.28:27017,10.xx.xx.5:27017/admin?w=0 -p table=test -p recordcount=10000000 -p readproportion=0.05 -p updateproportion=0.95 -p insertproportion=0 -p operationcount=10000000 -threads 100 >runlog.txt &

    5% Update + 95% Read

    Execute a total of 10,000,000 operations, where 5% are update operations and 95% are read operations, with no insert operations performed. The operations are executed in parallel using 100 threads, and the output is recorded in the runlog.txt file.
    nohup ./ycsb-0.17.0/bin/ycsb run mongodb -s -P workloads/workloada -p mongodb.url=mongodb://mongouser: password @10.xx.xx.30:27017,10.xx.xx.28:27017,10.xx.xx.5:27017/admin?w=0 -p table=test -p recordcount=10000000 -p readproportion=0.95 -p updateproportion=0.05 -p insertproportion=0 -p operationcount=10000000 -threads 100 >runlog.txt &

    100% Insert

    Execute a total of 10,000,000 operations, all of which are insert operations. The operations are executed in parallel using 100 threads, and the output is recorded in the runlog.txt file.
    nohup ./ycsb-0.17.0/bin/ycsb run mongodb -s -P workloads/workloadb -p mongodb.url=mongodb://mongouser: password @10.xx.xx.30:27017,10.xx.xx.28:27017,10.xx.xx.5:27017/admin?w=0 -p table=test -p recordcount=10000000 -p readproportion=0 -p updateproportion=0 -p insertproportion=1 -p operationcount=10000000 -threads 100 >runlog.txt &

    100% Read

    Execute a total of 10,000,000 operations, all of which are read operations. The operations are executed in parallel using 100 threads, and the output is recorded in the runlog.txt file.
    nohup ./ycsb-0.17.0/bin/ycsb run mongodb -s -P workloads/workloadc -p mongodb.url=mongodb://mongouser: password @10.xx.xx.30:27017,10.xx.xx.28:27017,10.xx.xx.5:27017/admin?w=0 -p table=test -p recordcount=10000000 -p readproportion=1 -p updateproportion=0 -p insertproportion=0 -p operationcount=10000000 -threads 100 >runlog.txt &

    100% Update

    Execute a total of 10,000,000 operations, all of which are update operations. The operations are executed in parallel using 100 threads, and the output is recorded in the runlog.txt file.
    nohup ./ycsb-0.17.0/bin/ycsb run mongodb -s -P workloads/workloadb -p mongodb.url=mongodb://mongouser: password @10.xx.xx.30:27017,10.xx.xx.28:27017,10.xx.xx.5:27017/admin?w=0 -p table=test -p recordcount=10000000 -p readproportion=0 -p updateproportion=1 -p insertproportion=0 -p operationcount=10000000 -threads 100 >runlog.txt &

    Step 4: Retrieving Test Data

    Tencent Cloud MongoDB tested versions 4.0 and 4.4, both Cloud Edition and Physical Edition, across different instance specifications. For detailed test results, see Test Results.
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support