ApsaraDB for MongoDB is developed based on the Apsara distributed system and a high-reliability storage engine, and is compatible with the MongoDB protocol. ApsaraDB for MongoDB uses a multi-node architecture to ensure high availability, and provides features such as elastic scaling, disaster recovery, backup and rollback, and performance optimization.
Test environment
Configuration item | ECS instance for stress testing | ApsaraDB for MongoDB instance that uses a physical server | ApsaraDB for MongoDB instance that uses cloud disks |
Region and zone | Hangzhou Zone H | Hangzhou Zone H | Hangzhou Zone H |
Network type | VPC | VPC | VPC |
Instance family | c6e, compute-optimized instance family with enhanced performance | General-purpose and dedicated | Dedicated |
Instance type | ecs.c6e.2xlarge (8 cores, 16 GB) | A variety of specifications are available. For more information, see Test results. | A variety of specifications are available. For more information, see Test results. |
Storage type | PL1 ESSDs | Local SSDs | PL1 ESSDs |
Storage space | - | 500 GB | 500 GB |
Topology | - | Standard replica set instance (three nodes: one primary node, one secondary node, and one hidden node) | Standard replica set instance (three nodes: one primary node, one secondary node, and one hidden node) |
Image version | Alibaba Cloud Linux 3.2104 LTS 64-bit | 3.10.0-327.ali2017.alios7.x86_64 | 4.19.81-17.2.al7.x86_64 |
Instance kernel version | - | MongoDB 4.2 (baseline of minor version 4.2.13) | MongoDB 4.4 (baseline of minor version 4.4.1) |
Consistency | - | Default read/write concern | Default read/write concern |
If the ECS instance and the ApsaraDB for MongoDB instances are deployed in the same region and zone, the Round-Trip Time (RTT) is approximately 0.104 milliseconds.
Test tool
Open-source YCSB 0.17.0 is used for stress testing.
YCSB is a Java tool that can be used in performance testing for multiple databases. For more information about its installation and usage, see YCSB.
Test procedure
Add the Primary Private IP Address of the ECS instance to a whitelist of the ApsaraDB for MongoDB instance that uses a physical server or one that uses cloud disks. For more information, see Modify a whitelist for an instance.
NoteYou can log on to the ECS console and then view the Primary Private IP Address in the Configuration Information section of the Instance Details page.
Connect to the ECS instance. For more information, see Connect to the ECS instance.
Use YCSB to load test data.
./bin/ycsb load mongodb -s -p workload=site.ycsb.workloads.CoreWorkload -p recordcount=1000000 -p mongodb.url="mongodb://test:****@dds-bp13e84d11****.mongodb.rds.aliyuncs.com:3717/admin" -threads 8
Modify the following parameter values:
recordcount=1000000
: The total number of data records loaded to the ApsaraDB for MongoDB instance.mongodb.url="mongodb://test:****@dds-bp13e84d11****.mongodb.rds.aliyuncs.com:3717/admin"
: The endpoint of the ApsaraDB for MongoDB instance. In this example, the database account is test and the database is admin.NoteYou can log on to the ApsaraDB for MongoDB console and then view instance endpoints in the Internal Connections - VPC section of the Database Connections page.
threads 8
: The number of concurrent threads on the client.
Run the following test command to perform performance stress testing.
./bin/ycsb run mongodb -s -p workload=site.ycsb.workloads.CoreWorkload -p recordcount=1000000 -p operationcount=5000000 -p insertproportion=0 -p readproportion=50 -p updateproportion=50 -p requestdistribution=zipfian -p mongodb.url="mongodb://test:****@dds-bp13e84d11****.mongodb.rds.aliyuncs.com:3717/admin" -threads 8
Modify the following parameter values:
recordcount=1000000
: The total number of data records loaded to the ApsaraDB for MongoDB instance.operationcount=5000000
: The total number of read/write operations.insertproportion=0
: The ratio of load operations.readproportion=50
: The ratio of read operations.updateproportion=50
: The ratio of update operations.mongodb.url="mongodb://test:****@dds-bp13e84d11****.mongodb.rds.aliyuncs.com:3717/admin"
: The endpoint of the ApsaraDB for MongoDB instance. In this example, the database account is test and the database is admin.NoteYou can log on to the ApsaraDB for MongoDB console and then view instance endpoints in the Internal Connections - VPC section of the Database Connections page.
threads 8
: The number of concurrent threads on the client.
Test results
Scenarios
r:w=100:0
: The ratio of read requests to write requests is 100:0.r:w=95:5
: The ratio of read requests to write requests is 95:5.r:w=50:50
: The ratio of read requests to write requests is 50:50.r:w=5:95
: The ratio of read requests to write requests is 5:95.r:w=0:100
: The ratio of read requests to write requests is 0:100.
Parameters
recordcount
: The total number of data records loaded to the ApsaraDB for MongoDB instance.operationcount
: The total number of read/write operations.threads
: The number of concurrent threads on the client.throughput
: The throughput of the ApsaraDB for MongoDB instance. Unit: Operation per second (OPS).RAL
: The average latency of read operations. Unit: microseconds (us).WAL
: The average latency of write operations. Unit: microseconds (us).
In this topic, if RAL
or WAL
is set to 0, no read or write operations are involved.
The following sections show the test results and performance comparison between the ApsaraDB for MongoDB instance that uses a physical server and one that uses cloud disks at different read/write ratios.
Instance that runs MongoDB 4.2 and uses a physical server
Instance that runs MongoDB 4.4 and uses cloud disks
Performance comparison charts
Result analysis
CPU:Memory=1:2
: The ApsaraDB for MongoDB instance that uses a physical server provides better performance than one that uses cloud disks. The performance difference is about 7% to 50% at different read/write ratios. The maximum difference exists on ApsaraDB for MongoDB instances that have 4 CPU cores and 8 GB of memory.CPU:Memory=1:4
: The performance difference between the ApsaraDB for MongoDB instance that uses a physical server and one that uses cloud disks is reduced to about 10%. The ApsaraDB for MongoDB instance that uses a physical server is suitable for write scenarios, and one that uses cloud disks is suitable for read scenarios.CPU:Memory=1:8
:The ApsaraDB for MongoDB instance that uses a physical server provides almost the same performance as one that uses cloud disks.
With the increase of memory, the ApsaraDB for MongoDB instance that uses cloud disks provides better performance than one that uses a physical server. The maximum difference exists on ApsaraDB for MongoDB instances that have 4 CPU cores and 32 GB of memory.
The ApsaraDB for MongoDB instance that uses cloud disks has the following benefits:
All resources are dedicated and can avoid the resource contention that occurs on the ApsaraDB for MongoDB instance that uses a physical server.
Compute and storage resources can be automatically scaled. No data migration is required.
ESSDs have performance levels (PLs) such as PL1, PL2, and PL3. ESSDs of these levels are more cost-effective for pay-as-you-go ApsaraDB for MongoDB instances.